Skip to content

build(deps): bump actions/actions-runner #65

build(deps): bump actions/actions-runner

build(deps): bump actions/actions-runner #65

Workflow file for this run

name: Pipeline
on:
push:
branches:
- "**" # Matches all branches
pull_request:
branches:
- "**" # Matches all branches
workflow_dispatch:
inputs:
force_build:
description: "Forces a build even if no changes are detected"
required: true
default: "false"
force_release:
description: "Forces a release even if no changes are detected"
required: true
default: "false"
concurrency:
group: pipeline-${{ github.ref_name }}
cancel-in-progress: true
env:
container_image: "github-actions-runner"
container_image_build_context: "src"
container_image_build_dockerfile: "src/Dockerfile"
container_image_repository_dockerhub: "emberstack"
container_image_repository_ghcr: "ghcr.io/emberstack"
jobs:
discovery:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
pathsFilter_src: ${{ steps.pathsFilter.outputs.src }}
base_version: ${{ steps.extract_base_version.outputs.version }}
full_version: ${{ steps.extract_base_version.outputs.full_version }}
build: ${{ steps.evaluate_build.outputs.result }}
build_push: ${{ steps.evaluate_build_push.outputs.result }}
build_configuration: ${{ steps.evaluate_build_configuration.outputs.result }}
release: ${{ steps.evaluate_release.outputs.result }}
steps:
- name: checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: extract - base version from Dockerfile and calculate version
id: extract_base_version
run: |
BASE_VERSION=$(grep "^FROM ghcr.io/actions/actions-runner:" ${{ env.container_image_build_dockerfile }} | cut -d':' -f2)
echo "Extracted base version: $BASE_VERSION"
echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
# Calculate build number based on commits since last tag with this base version
BUILD_NUMBER=1
LAST_TAG=$(git tag --list "v${BASE_VERSION}+*" 2>/dev/null | sort -V | tail -1 || echo "")
if [ -n "$LAST_TAG" ]; then
# Extract the build number from the last tag and increment
LAST_BUILD=$(echo "$LAST_TAG" | sed "s/v${BASE_VERSION}+//")
BUILD_NUMBER=$((LAST_BUILD + 1))
fi
# If no matching tags exist for this base version, BUILD_NUMBER stays at 1
FULL_VERSION="${BASE_VERSION}+${BUILD_NUMBER}"
echo "Full version with build metadata: $FULL_VERSION"
echo "full_version=$FULL_VERSION" >> $GITHUB_OUTPUT
- name: tools - detect changes
id: pathsFilter
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref }}
filters: |
src:
- '*.sln'
- '*.slnx'
- '*.props'
- 'src/**'
build:
- '*.sln'
- '*.slnx'
- '*.props'
- 'src/**'
- 'tests/**'
- 'playground/**'
- name: evaluate - build
id: evaluate_build
env:
RESULT: ${{ steps.pathsFilter.outputs.build == 'true' || github.event.inputs.force_build == 'true' || github.event.inputs.force_release == 'true' }}
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
- name: evaluate - build_push
id: evaluate_build_push
env:
RESULT: ${{ github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && (steps.pathsFilter.outputs.src == 'true' || github.event.inputs.force_build == 'true') }}
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
- name: evaluate - build_configuration
id: evaluate_build_configuration
env:
RESULT: ${{ github.ref == 'refs/heads/main' && 'Release' || 'Debug' }}
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
- name: evaluate - release
id: evaluate_release
env:
RESULT: ${{ github.ref == 'refs/heads/main' || github.event.inputs.force_release == 'true' }}
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
build:
name: build - ${{ matrix.platform }}
if: ${{ needs.discovery.outputs.build == 'true' }}
needs: [discovery]
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: linux/amd64
- runner: ubuntu-24.04-arm
platform: linux/arm64
runs-on: ${{ matrix.runner }}
env:
build: ${{ needs.discovery.outputs.build }}
build_push: ${{ needs.discovery.outputs.build_push }}
build_configuration: ${{ needs.discovery.outputs.build_configuration }}
base_version: ${{ needs.discovery.outputs.base_version }}
steps:
- name: checkout
uses: actions/checkout@v5
- name: tools - docker - login ghcr.io
if: ${{ env.build_push == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ES_GITHUB_PAT }}
- name: tools - docker - login docker.io
if: ${{ env.build_push == 'true' }}
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
- name: tools - docker - setup buildx
uses: docker/setup-buildx-action@v3
- name: docker - build and push
uses: docker/build-push-action@v6
with:
context: ${{ env.container_image_build_context }}
file: ${{ env.container_image_build_dockerfile }}
build-args: |
BUILD_CONFIGURATION=${{ env.build_configuration }}
push: ${{ env.build_push == 'true' }}
provenance: false
platforms: ${{ matrix.platform }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=https://github.com/${{ github.repository_owner }}
org.opencontainers.image.version=${{ env.base_version }}
org.opencontainers.image.revision=${{ github.sha }}
tags: |
${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.base_version }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.base_version }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
manifest:
name: build - manifest
if: ${{ needs.discovery.outputs.build_push == 'true' }}
needs: [discovery, build]
runs-on: ubuntu-latest
env:
base_version: ${{ needs.discovery.outputs.base_version }}
steps:
- name: checkout
uses: actions/checkout@v5
- name: tools - docker - login ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ES_GITHUB_PAT }}
- name: tools - docker - login docker.io
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
- name: tools - docker - setup buildx
uses: docker/setup-buildx-action@v3
- name: docker - create and push multi-arch manifest
run: |
docker buildx imagetools create \
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.base_version }} \
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.base_version }} \
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.base_version }}-amd64 \
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.base_version }}-arm64
- name: artifacts - upload readme
uses: actions/upload-artifact@v5
with:
name: readme
path: README.md
retention-days: 1
release:
name: release
if: ${{ needs.discovery.outputs.release == 'true' && github.ref == 'refs/heads/main' }}
needs: [discovery, manifest]
runs-on: ubuntu-latest
env:
base_version: ${{ needs.discovery.outputs.base_version }}
full_version: ${{ needs.discovery.outputs.full_version }}
steps:
- name: tools - docker - login ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ES_GITHUB_PAT }}
- name: tools - docker - login docker.io
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
- name: tools - docker - setup buildx
uses: docker/setup-buildx-action@v3
- name: docker - tag and push - latest
run: |
docker buildx imagetools create \
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:latest \
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:latest \
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.base_version }}
- name: github - release - create
uses: softprops/action-gh-release@v2
with:
repository: ${{ github.repository }}
name: v${{ env.full_version }}
tag_name: v${{ env.full_version }}
body: |
Docker image version: `${{ env.base_version }}`
Release version: `${{ env.full_version }}`
The release process is automated.
generate_release_notes: true
token: ${{ secrets.ES_GITHUB_PAT }}
- name: artifacts - download readme
uses: actions/download-artifact@v6
with:
name: readme
path: .
- name: dockerhub - readme - sync
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
repository: ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}
readme-filepath: ./README.md
short-description: "Enhanced GitHub Actions self-hosted runner with comprehensive development tools"