06c4a1c886
Build & Deploy / deploy (push) Failing after 18s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
name: Build & Deploy
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login au registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
|
docker login registry.maisongrondin.fr \
|
|
-u ${{ secrets.REGISTRY_USERNAME }} \
|
|
--password-stdin
|
|
|
|
- name: Build et push vers le registry
|
|
run: |
|
|
docker build \
|
|
-t registry.maisongrondin.fr/alexandre/budget-commun:${{ gitea.ref_name }} \
|
|
-t registry.maisongrondin.fr/alexandre/budget-commun:latest \
|
|
-f backend/Dockerfile .
|
|
docker push registry.maisongrondin.fr/alexandre/budget-commun:${{ gitea.ref_name }}
|
|
docker push registry.maisongrondin.fr/alexandre/budget-commun:latest
|
|
|
|
- name: Mettre à jour la version sur TrueNAS
|
|
run: |
|
|
echo "${{ secrets.NAS_SSH_KEY }}" > /tmp/nas_key
|
|
chmod 600 /tmp/nas_key
|
|
ssh -i /tmp/nas_key -o StrictHostKeyChecking=no truenas_admin@192.168.1.200 \
|
|
"sudo sed -i 's/\"app_version\": \".*\"/\"app_version\": \"${{ gitea.ref_name }}\"/' \
|
|
/mnt/.ix-apps/app_configs/budget-commun/versions/1.0.0/app.yaml && \
|
|
sudo sed -i 's/^\"version\": \".*\"/\"version\": \"${{ gitea.ref_name }}\"/' \
|
|
/mnt/.ix-apps/app_configs/budget-commun/versions/1.0.0/app.yaml"
|
|
rm /tmp/nas_key
|
|
|
|
- name: Redéployer sur TrueNAS
|
|
run: |
|
|
curl -sf -X POST http://172.16.11.1/api/v2.0/app/redeploy \
|
|
-H "Authorization: Bearer ${{ secrets.TRUENAS_API_KEY }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '"budget-commun"'
|