ci #10
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: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg_version: | |
- "16" | |
- "15" | |
# - "13" | |
platform: | |
- "amd64" | |
- "arm64" | |
env: | |
PG_LATEST: "16" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
if: matrix.platform != 'amd64' | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Get build date | |
id: date | |
run: echo "date=$(date --rfc-3339 ns)" >> $GITHUB_OUTPUT | |
- name: Get latest tag | |
id: tag-latest | |
if: matrix.pg_version == env.PG_LATEST | |
run: echo "tag=${{ matrix.platform == 'amd64' && ' latest' || format(' latest-{0}', matrix.platform) }}" >> $GITHUB_OUTPUT | |
- name: Build image Postgres | |
id: buildpg | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: postgres-autoconf | |
tags: ${{ matrix.platform == 'amd64' && format('{0}-alpine', matrix.pg_version) || format('{0}-alpine-{1}', matrix.pg_version, matrix.platform) }}${{ steps.tag-latest.outputs.tag || '' }} | |
context: . | |
platforms: linux/${{ matrix.platform }} | |
containerfiles: | | |
Dockerfile | |
build-args: | | |
BUILD_DATE=${{ steps.date.outputs.date }} | |
VCS_REF=${{ github.sha }} | |
BASE_TAG=${{ matrix.pg_version }}-alpine | |
- name: Push image Postgres to GHCR | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.buildpg.outputs.image }} | |
tags: ${{ steps.buildpg.outputs.tags }} | |
registry: ghcr.io/openspp | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image PostGIS | |
id: buildpgis | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: postgis-autoconf | |
tags: ${{ matrix.platform == 'amd64' && format('{0}-alpine', matrix.pg_version) || format('{0}-alpine-{1}', matrix.pg_version, matrix.platform) }}${{ steps.tag-latest.output.tag || '' }} | |
context: . | |
platforms: linux/${{ matrix.platform }} | |
containerfiles: | | |
Dockerfile-GIS | |
build-args: | | |
BUILD_DATE=${{ steps.date.output.date }} | |
VCS_REF=${{ github.sha }} | |
BASE_TAG=${{ matrix.pg_version }}-alpine | |
- name: Push image PostGIS to GHCR | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.buildpgis.outputs.image }} | |
tags: ${{ steps.buildpgis.outputs.tags }} | |
registry: ghcr.io/openspp | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |