diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-20 23:02:02 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-20 23:02:02 +0100 |
| commit | 2ef155c0c68208eccf968919fea12133698b50a9 (patch) | |
| tree | b95e2e19cb4a277881c5569d9f132b4a7cae7a59 | |
| parent | bee85bf92aab84087798ffa9f3f16336acef2fce (diff) | |
Ideally set up actions for database migration
| -rw-r--r-- | .github/workflows/deploy.yml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6db98b2..aede90b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -85,6 +85,10 @@ jobs: dotnet-version: "9.0.x" - name: Build backend run: dotnet publish -c Release -r linux-arm64 --self-contained false src/Enmarcha.Backend/Enmarcha.Backend.csproj -o dist/backend + - name: Install dotnet-ef tool + run: dotnet tool install --global dotnet-ef + - name: Build EF migrations bundle + run: dotnet ef migrations bundle --project src/Enmarcha.Backend/Enmarcha.Backend.csproj -r linux-arm64 --self-contained -o dist/backend/efbundle - name: Archive Backend Artifact uses: actions/upload-artifact@v5 with: @@ -149,7 +153,11 @@ jobs: - name: Allow execution if: needs.detect-changes.outputs.backend == 'true' - run: ssh ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }} "chmod +x /opt/enmarcha/Enmarcha.Backend" + run: ssh ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }} "chmod +x /opt/enmarcha/Enmarcha.Backend /opt/enmarcha/efbundle" + + - name: Apply database migrations + if: needs.detect-changes.outputs.backend == 'true' + run: ssh ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }} "ASPNETCORE_ENVIRONMENT=Production /opt/enmarcha/efbundle" - name: Start service if: needs.detect-changes.outputs.backend == 'true' |
