Bumped PB to 0.36.6 and getting PB_Version from Dockerfile instead of env variables #22
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: Build Pocketbase MultiArch | |
| on: | |
| pull_request: | |
| branches: | |
| - production | |
| types: | |
| - closed | |
| jobs: | |
| if_merged: | |
| if: github.event.pull_request.merged == true | |
| name: Build Pocketbase AMD64 and Push | |
| runs-on: ubuntu-latest | |
| steps: | |
| # STEP 1: Checkout the code | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 1 | |
| # STEP 2: Extract PB_VERSION from Dockerfile | |
| - name: Get PB version | |
| id: pb_version | |
| run: | | |
| VERSION=$(grep -oP 'PB_VERSION=\K[^\s]+' Dockerfile) | |
| if [ -z "$VERSION" ]; then echo "PB_VERSION not found" && exit 1; fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - | |
| name: Container Metadata | |
| uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: docker.io/${{ vars.DOCKERHUB_USERNAME }}/pocketbase | |
| tags: | | |
| type=raw,value=${{ steps.pb_version.outputs.version }} | |
| type=raw,value=latest | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and Push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| tags: ${{ steps.meta.outputs.tags }} | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| push: true | |
| build-args: | | |
| PB_VERSION=${{ vars.PB_VERSION }} | |
| - name: Trigger Dokploy Deployment | |
| run: | | |
| curl -X 'POST' \ | |
| '${{ secrets.DOKPLOY_WEBHOOK_URL }}' \ | |
| -H 'Content-Type: application/json' \ | |
| -H 'x-github-event: push' \ | |
| -d '{ | |
| "ref": "refs/heads/production", | |
| "head_commit": { | |
| "id": "${{ github.sha }}", | |
| "message": "Deployment from Github Actions" | |
| } | |
| }' |