mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-12 13:47:01 +00:00
- Build CI images with immutable ci-<sha> tags instead of latest - Pass CI image tag into deploy workflows via INFINITO_IMAGE_TAG - Derive CI_TAG from checked-out release tag commit - Retag CI images to <version> and latest on release (no rebuild) - Make release scripts independent from GITHUB_SHA coupling - Improve robustness and reproducibility of release pipeline https://chatgpt.com/share/696832f6-35e4-800f-a574-178013d4426e
83 lines
2.0 KiB
YAML
83 lines
2.0 KiB
YAML
name: Release Version Logic
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
description: "Version tag to release (e.g. v1.2.3)"
|
|
required: true
|
|
type: string
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Version tag to release (e.g. v1.2.3)"
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: infinito-ci-global
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
security-events: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
# unify input source (call vs dispatch)
|
|
env:
|
|
VERSION_TAG: ${{ inputs.tag || github.event.inputs.tag }}
|
|
CI_TAG: ""
|
|
OWNER: ${{ github.repository_owner }}
|
|
REGISTRY: ghcr.io
|
|
REPO_PREFIX: infinito
|
|
DISTROS: "arch debian ubuntu fedora centos"
|
|
DEFAULT_DISTRO: arch
|
|
|
|
steps:
|
|
- name: Checkout repository at version tag
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ env.VERSION_TAG }}
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Compute CI_TAG from checked out tag commit
|
|
id: citag
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
sha="$(git rev-parse HEAD)"
|
|
echo "CI_TAG=ci-${sha}" >> "$GITHUB_ENV"
|
|
echo "Using CI_TAG=ci-${sha}"
|
|
|
|
- name: Verify this is the highest version
|
|
id: highest
|
|
shell: bash
|
|
run: scripts/release/is-highest.sh
|
|
|
|
- name: Move 'stable' tag (only if highest)
|
|
if: steps.highest.outputs.is_highest == 'true'
|
|
shell: bash
|
|
run: scripts/release/move-stable-tag.sh
|
|
|
|
- name: Retag CI images to version/latest (no rebuild)
|
|
shell: bash
|
|
env:
|
|
GITHUB_REF_NAME: ${{ env.VERSION_TAG }}
|
|
run: scripts/release/retag-ci-images.sh
|