define public urls in docker file #4
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: Astro Build and Deploy | |
| on: | |
| push: | |
| branches: [ master, testing ] | |
| jobs: | |
| build: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: git.zigz.uk | |
| username: ${{ secrets.REGISTRY_USERNAME }} | |
| password: ${{ secrets.REGISTRY_PASSWORD }} | |
| - name: Set Lowercase Branch Name | |
| id: branch_vars | |
| run: | | |
| LOWER_BRANCH_NAME=$(echo "${{ github.ref_name }}" | tr '[:upper:]' '[:lower:]') | |
| echo "lower_branch_name=$LOWER_BRANCH_NAME" >> $GITHUB_OUTPUT | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| git.zigz.uk/radeonrr/radeon-${{ steps.branch_vars.outputs.lower_branch_name }}-blog:${{ github.sha }} | |
| git.zigz.uk/radeonrr/radeon-${{ steps.branch_vars.outputs.lower_branch_name }}-blog:latest | |
| notify_success: | |
| needs: build | |
| if: success() | |
| runs-on: self-hosted | |
| steps: | |
| - name: Send Success Webhook | |
| run: | | |
| WEBHOOK_URL="${{ secrets.DEPLOYMENT_WEBHOOK_URL }}" | |
| WEBHOOK_SECRET="${{ secrets.WEBHOOK_DEPLOY_TOKEN }}" | |
| if [ -z "$WEBHOOK_URL" ]; then | |
| echo "Skipping webhook: DEPLOYMENT_WEBHOOK_URL secret is not set." | |
| exit 0 | |
| fi | |
| curl -X POST "$WEBHOOK_URL" \ | |
| -H 'Content-Type: application/json' \ | |
| -H "X-Secret-Token: ${WEBHOOK_SECRET}" \ | |
| -d "{ | |
| \"status\": \"success\", | |
| \"repository\": \"${{ github.repository }}\", | |
| \"commit_sha\": \"${{ github.sha }}\", | |
| \"branch\": \"${{ github.ref_name }}\", | |
| \"message\": \"Astro Docker image built and pushed successfully.\", | |
| \"services_built\": \"radeon-blog\", | |
| \"run_url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\" | |
| }" |