Rewrite, simplify matchedAgainstPattern
(#830)
#260
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: Docker image build (nightly) | |
# Pipeline which builds `nightly` Docker images for Quesma | |
# pushes them to Docker Hub as `quesma/quesma:nightly` (and `quesma/quesma:<VERSION>`, if VERSION is specified explicitly) | |
# | |
# This workflow is triggered by a push/merge to the `main` branch | |
# quesma/quesma:latest image is a pointer to latest released version. | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: # Handy for testing | |
inputs: | |
VERSION: | |
description: 'Version number to tag the image with (optional)' | |
default: nightly | |
required: true | |
PUSH: | |
description: 'Whether to push the image to the registry' | |
default: false | |
required: true | |
jobs: | |
build-quesma-docker-image: | |
strategy: | |
matrix: | |
module: [ "quesma" ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
cache-dependency-path: ${{ matrix.module }}/go.sum | |
go-version: '1.22' | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PAT }} | |
- name: Set the build date | |
run: echo QUESMA_BUILD_DATE=$(git --no-pager log -1 --date=format:'%Y-%m-%d' --format="%ad") >> $GITHUB_ENV | |
- name: Build and export | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.module }}/. | |
# when called from the main branch, `github.event.inputs.VERSION` doesn't use default value and is just empty | |
tags: | | |
quesma/quesma:${{ github.event.inputs.VERSION || 'nightly' }} | |
quesma/quesma:nightly | |
# Pushes to DockerHub only for `main` branch builds, unless set explicitly in the job input | |
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event.inputs.PUSH }} | |
build-args: | | |
QUESMA_BUILD_SHA=${{ github.sha }} | |
QUESMA_VERSION=${{ github.event.inputs.VERSION }} | |
QUESMA_BUILD_DATE=${{ env.QUESMA_BUILD_DATE }} | |
platforms: linux/amd64,linux/arm64 | |
env: | |
DOCKER_BUILD_SUMMARY: false |