Skip to content

publish

publish #382

Workflow file for this run

name: publish
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: 'Omnibus version tag to use for images'
required: true
projects:
description: 'Comma separated list of projects to test'
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_matrix:
runs-on: ubuntu-latest
env:
PROJECTS: ${{ github.event.inputs.projects }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
if [ -n "${{ env.PROJECTS }}" ]; then
echo "matrix=$(echo "${{ env.PROJECTS }}" | sed 's/, */,/g' | tr ',' '\n' | jq --raw-input . | jq -c --slurp .)" >> $GITHUB_OUTPUT
else
echo "matrix=$(find * -type f -name build.yml | xargs dirname | sort | uniq | jq --raw-input . | jq -c --slurp .)" >> $GITHUB_OUTPUT
fi
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) }}
env:
TAG: ${{ github.event.inputs.tag }}
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=${{ env.TAG || github.ref_name }}-${{matrix.project}}-$VERSION" >> $GITHUB_OUTPUT
else
echo "image-tag=${{ env.TAG || github.ref_name }}-${{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