Skip to content

publish

publish #374

Workflow file for this run

name: publish
on:
push:
tags:
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
echo "matrix=$(find * -type f -name build.yml | xargs dirname | sort | uniq | jq --raw-input . | jq -c --slurp .)" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
build:
needs: build_matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
project: ${{ fromJson(needs.build_matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get image tag
id: get-image-tag
run: |
VERSION=$(yq '.services.node.build.args.VERSION // ""' ./${{matrix.project}}/build.yml)
if [ -n "$VERSION" ]; then
echo "image-tag=${GITHUB_REF#refs/tags/}-${{matrix.project}}-$VERSION" >> $GITHUB_OUTPUT
else
echo "image-tag=${GITHUB_REF#refs/tags/}-${{matrix.project}}" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/bake-action@v5
with:
workdir: ${{ matrix.project}}
files: build.yml
allow: fs.read=..
set: |
node.tags=ghcr.io/${{ github.repository }}:${{ steps.get-image-tag.outputs.image-tag }}
node.platform=linux/amd64
push: true