This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Update README.md #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
| name: Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| packages: write | |
| jobs: | |
| configure: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.get-versions.outputs.result }} | |
| distro: ${{ steps.get-distro.outputs.result }} | |
| steps: | |
| - name: Checkout to repository | |
| uses: actions/checkout@v4 | |
| - name: Get dependency versions | |
| uses: mikefarah/yq@v4.45.4 | |
| id: get-versions | |
| with: | |
| cmd: yq eval 'del(.alpine)' -o=json -I=0 versions.yaml | |
| - name: Get distro version | |
| uses: mikefarah/yq@v4.45.4 | |
| id: get-distro | |
| with: | |
| cmd: yq eval '.alpine' -I=0 versions.yaml | |
| build_and_push: | |
| runs-on: ubuntu-latest | |
| needs: configure | |
| strategy: | |
| # Prevent a failure in one image from stopping the other builds | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.configure.outputs.matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.6.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.10.0 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3.4.0 | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine version change | |
| id: changed-version | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files: versions.yaml | |
| - name: Determine image push | |
| uses: actions/github-script@v7 | |
| id: should-release | |
| with: | |
| script: | | |
| if (context.eventName == "pull_request") return false; | |
| if (context.eventName == "workflow_dispatch") return true; | |
| return "${{ steps.changed-version.outputs.any_changed }}" == "true"; | |
| - name: Set major postgres version | |
| id: version | |
| run: | | |
| pg_major=$(echo ${{ matrix.postgres }} | cut -d'.' -f1) | |
| echo "pg_major=$pg_major" >> "$GITHUB_OUTPUT" | |
| - name: Generate docker image tags | |
| id: metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| flavor: | | |
| # Disable latest tag | |
| latest=false | |
| images: | | |
| name=ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ matrix.postgres }},enable=${{ steps.should-release.outputs.result }} | |
| type=raw,value=${{ steps.version.outputs.pg_major }},enable=${{ steps.should-release.outputs.result }} | |
| - name: Build and push image | |
| uses: docker/build-push-action@v6.18.0 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ !github.event.pull_request.head.repo.fork && steps.metadata.outputs.tags != '' }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| tags: ${{ steps.metadata.outputs.tags }} | |
| labels: ${{ steps.metadata.outputs.labels }} | |
| build-args: | | |
| PG_VERSION=${{ matrix.postgres }} | |
| ALPINE_VERSION=${{ needs.configure.outputs.distro }} |