Merge pull request #95 from AptFox/dev #6
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
| name: prod-deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Log in to GHCR | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Build image | |
| - name: Build new container image | |
| run: docker build -t ${{ vars.IMAGE_NAME }}:latest . | |
| # Push image | |
| - name: Push image | |
| run: docker push ${{ vars.IMAGE_NAME }}:latest | |
| # Trigger deploy on VPS (web hook) | |
| - name: Trigger prod deployment | |
| if: success() # Only runs if previous steps succeeded | |
| run: | | |
| curl -X 'POST' "${{ secrets.PROD_DEPLOY_WEB_HOOK_URL }}" \ | |
| -H 'accept: application/json' \ | |
| -H "Content-Type: application/json" \ | |
| -H "x-api-key: ${{ secrets.API_KEY }}" \ | |
| -d "{ \"applicationId\": \"${{ secrets.APP_ID }}\" }" |