migrate image tags from docker-compose.yaml to .env #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################################### | |
| # GitOps Deployment — Demo (dry-run) | |
| # | |
| # Simulates the self-hosted runner deployment workflow on ubuntu-latest. | |
| # Echoes what each step would do instead of actually deploying. | |
| ############################################################################### | |
| name: "CI: Deploy (Demo)" | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - "projects/demo-app/**" | |
| - ".github/workflows/ci-deployment-self-hosted.yaml" | |
| workflow_dispatch: | |
| concurrency: | |
| group: deployment | |
| cancel-in-progress: false | |
| env: | |
| PROJECT_PATH: "projects/demo-app" | |
| REMOTE_PATH: "/opt/demo-app" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend_version: ${{ steps.versions.outputs.backend }} | |
| frontend_version: ${{ steps.versions.outputs.frontend }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "[dry-run] Copy files to deployment directory" | |
| run: | | |
| echo "Would copy ${{ env.PROJECT_PATH }}/* -> ${{ env.REMOTE_PATH }}/" | |
| ls -la ${{ env.PROJECT_PATH }}/ | |
| - name: "[dry-run] Deploy" | |
| run: | | |
| echo "Would run: cd ${{ env.REMOTE_PATH }} && ./deployment.sh" | |
| echo "--- deployment.sh contents ---" | |
| cat ${{ env.PROJECT_PATH }}/deployment.sh | |
| echo "--- docker-compose.yaml contents ---" | |
| cat ${{ env.PROJECT_PATH }}/docker-compose.yaml | |
| - name: Get deployed versions | |
| id: versions | |
| run: | | |
| source ${{ env.PROJECT_PATH }}/.env | |
| echo "backend=${BACKEND_TAG}" >> $GITHUB_OUTPUT | |
| echo "frontend=${FRONTEND_TAG}" >> $GITHUB_OUTPUT | |
| echo "Backend: ${BACKEND_TAG}" | |
| echo "Frontend: ${FRONTEND_TAG}" | |
| notify: | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Print deployment summary | |
| run: | | |
| echo "Deployment: ${{ needs.deploy.result }}" | |
| echo "Backend: ${{ needs.deploy.outputs.backend_version }}" | |
| echo "Frontend: ${{ needs.deploy.outputs.frontend_version }}" | |
| echo "Commit: ${{ github.sha }}" |