feat: properly tag different platforms #7
This file contains 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: ci | ||
permissions: | ||
packages: write | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
# See https://crontab.guru/monthly | ||
- cron: 0 0 1 * * | ||
jobs: | ||
build-test-push: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
pg_version: | ||
- "16" | ||
- "15" | ||
- "13" | ||
platform: | ||
- "amd64" | ||
- "arm64" | ||
env: | ||
LATEST_RELEASE: "16" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
if: matrix.platform == 'arm64' | ||
with: | ||
platforms: arm64 | ||
- name: Get build date | ||
id: date | ||
run: echo "date=$(date --rfc-3339 ns)" >> $GITHUB_OUTPUT | ||
- name: Build image | ||
id: build | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: postgres-autoconf | ||
tags: ${{ matrix.pg_version }}-alpine${{ matrix.platform != 'amd64' && '-' + matrix.platform || '' }}${{ matrix.pg_version == env.LATEST_RELEASE && ' latest' || '' }}${{ matrix.pg_version == env.LATEST_RELEASE && matrix.platform != 'amd64' && '-' + matrix.platform || '' }} | ||
Check failure on line 50 in .github/workflows/ci.yaml GitHub Actions / ciInvalid workflow file
|
||
context: . | ||
platforms: linux/${{ matrix.platform }} | ||
containerfiles: | | ||
Dockerfile | ||
build-args: | | ||
BUILD_DATE=${{ steps.date.output }} | ||
VCS_REF=${{ github.sha }} | ||
BASE_TAG=${{ matrix.pg_version }}-alpine | ||
- name: Push image to GHCR | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build.outputs.image }} | ||
tags: ${{ steps.build.outputs.tags }} | ||
registry: ghcr.io/cmwedding-it | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||