Files
budget-commun/.gitea/workflows/deploy.yml
T
alexandre grondin 12a5dc7aba
Build & Deploy / deploy (push) Failing after 20s
ci: mise à jour version TrueNAS app.yaml à chaque tag
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 13:07:52 +02:00

48 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: |
ssh -i <(echo "${{ secrets.NAS_SSH_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"
- 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"'