mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
Replace native arm64 runners (unavailable on free tier) with QEMU emulation. All three image builds now trigger automatically on `release: published`, deriving version and :latest flag from the GitHub release event. workflow_dispatch retained for manual rebuilds.
88 lines
2.9 KiB
YAML
88 lines
2.9 KiB
YAML
name: Build Disk Collector Image
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Semantic version to label the Docker image under (no "v" prefix, e.g. "1.2.3")'
|
|
required: true
|
|
type: string
|
|
tag_latest:
|
|
description: 'Also tag this image as :latest?'
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
check_authorization:
|
|
name: Check authorization to publish new Docker image
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
isAuthorized: ${{ steps.check-auth.outputs.is_authorized }}
|
|
steps:
|
|
- name: check-auth
|
|
id: check-auth
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "release" ]; then
|
|
echo "is_authorized=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "is_authorized=${{ contains(secrets.DEPLOYMENT_AUTHORIZED_USERS, github.triggering_actor) }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
build:
|
|
name: Build and push multi-arch disk-collector image
|
|
needs: check_authorization
|
|
if: needs.check_authorization.outputs.isAuthorized == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Resolve version and tags
|
|
id: vars
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "release" ]; then
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
VERSION="${VERSION#v}"
|
|
TAG_LATEST=${{ !github.event.release.prerelease }}
|
|
else
|
|
VERSION="${{ inputs.version }}"
|
|
TAG_LATEST=${{ inputs.tag_latest }}
|
|
fi
|
|
|
|
TAGS="ghcr.io/${{ github.repository_owner }}/project-nomad-disk-collector:${VERSION}
|
|
ghcr.io/${{ github.repository_owner }}/project-nomad-disk-collector:v${VERSION}"
|
|
if [ "$TAG_LATEST" = "true" ]; then
|
|
TAGS="$TAGS
|
|
ghcr.io/${{ github.repository_owner }}/project-nomad-disk-collector:latest"
|
|
fi
|
|
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "tags<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$TAGS" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: install/sidecar-disk-collector
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.vars.outputs.tags }}
|
|
- name: Inspect image
|
|
run: |
|
|
docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/project-nomad-disk-collector:${{ steps.vars.outputs.version }}
|