chore(images): add delta tool #27
Workflow file for this run
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: Publish Runner Image | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: Runner version (when empty the version set a containerfile is used) | |
default: '' | |
workflow_call: | |
inputs: | |
version: | |
type: string | |
description: Runner version (when empty the version set a containerfile is used) | |
default: '' | |
outputs: | |
tag: | |
description: 'Published tag' | |
value: ${{ jobs.image.outputs.tag }} | |
version: | |
description: 'Published tag version without revision' | |
value: ${{ jobs.image.outputs.version }} | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository_owner }}/actions-runner | |
jobs: | |
image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
outputs: | |
tag: ${{ steps.roll.outputs.tag }} | |
version: ${{ steps.roll.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Runner Version | |
id: runner | |
run: | | |
version="${{ inputs.version }}"; version="${version#v}" | |
from_file="$(cat runners/Containerfile | | |
sed -En '/ARG\s+RUNNER_VERSION/ { s/ARG\s+RUNNER_VERSION=//; p; }')" | |
echo "version=${version:-$from_file}" >> $GITHUB_OUTPUT | |
- name: Rolling tag | |
uses: bitdeps/rolling-tag@v1 | |
id: roll | |
with: | |
version: v${{ steps.runner.outputs.version }} | |
releases-only: false | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=${{ steps.roll.outputs.tag }} | |
type=raw,value=${{ steps.roll.outputs.version }} | |
type=raw,value=latest,enable=${{ steps.roll.outputs.updates-latest == 'true' }} | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
file: runners/Containerfile | |
context: ./runners | |
# Publish image when the workflow is explicitly invoked | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: | | |
linux/amd64 | |
build-args: | | |
RUNNER_VERSION=${{ steps.runner.outputs.version }} | |
- name: Create Tag | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
custom_tag: ${{ steps.roll.outputs.tag }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# v is already accommodated | |
tag_prefix: '' |