ci(deps): update peter-evans/create-pull-request action to v7 #89
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: LilyPond Version | |
type: string | |
required: true | |
tags: | |
description: Additional Docker Tags | |
type: string | |
required: false | |
default: "" | |
push: | |
description: Push to Registries | |
type: boolean | |
required: false | |
default: false | |
pull_request: | |
push: | |
branches: [main] | |
env: | |
IMAGE: "codello/lilypond" | |
jobs: | |
setup: | |
name: Setup Build Workflow | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.matrix.outputs.matrix }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Load version matrix | |
id: matrix | |
env: | |
VERSION: ${{ github.events.inputs.version }} | |
TAGS: ${{ github.events.inputs.tags }} | |
run: | | |
if [ "$VERSION" ]; then | |
VALUES=$(jq -nc '[{version: env.VERSION, tags: (env.TAGS // "" | sub("\\s*,\\s*"; "\n"))}]') | |
else | |
VALUES=$(jq -c '[to_entries[] | .value * {tags: (.key + "\n" + (.value.tags // [] | join("\n")))}]' versions.json) | |
fi | |
MATRIX=$(jq -c '{include: .}' <<< "$VALUES") | |
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
build: | |
name: Build LilyPond ${{ matrix.version }} | |
runs-on: ubuntu-latest | |
needs: [setup] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: {submodules: recursive} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Generate image tags | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE }} | |
ghcr.io/${{ env.IMAGE }} | |
tags: | | |
type=raw,value=${{ matrix.version }} | |
${{ matrix.tags }} | |
labels: | | |
maintainer=Kim Wittenburg <[email protected]> | |
org.opencontainers.image.version=${{ matrix.version }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
flavor: latest=false | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
push: false | |
load: true | |
tags: ${{ env.IMAGE }}:${{ matrix.version }} | |
build-args: | | |
VERSION=${{ matrix.version }} | |
GUILE_VERSION=${{ matrix.guile }} | |
- name: Test Image | |
env: | |
VERSION: ${{ matrix.version }} | |
run: | | |
docker run -v $(pwd):/work "$IMAGE:$VERSION" test.ly | |
test -f test.pdf | |
- name: Push Image | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || ${{ github.events.inputs.push }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
VERSION=${{ matrix.version }} | |
GUILE_VERSION=${{ matrix.guile }} |