123 lines
4.9 KiB
YAML
123 lines
4.9 KiB
YAML
name: Prepare Build Inputs
|
||
description: Detect OS version information for build inputs across multiple OS variants
|
||
author: Tom Foster
|
||
|
||
inputs:
|
||
os-name:
|
||
description: Operating system name (ubuntu, fedora, debian)
|
||
required: true
|
||
previous-tag:
|
||
description: >-
|
||
Docker tag for the previous version, or `auto` to derive it from the detected
|
||
latest release. Ubuntu/Fedora have no rolling "previous" tag upstream (unlike
|
||
Debian's `oldstable`), so `auto` computes it: Ubuntu LTS = latest major − 2 (.04),
|
||
Fedora = latest − 1. Pass an explicit tag (e.g. oldstable) for anything else.
|
||
required: true
|
||
latest-tag:
|
||
description: Docker tag for latest/stable version (e.g., latest, latest, stable)
|
||
required: true
|
||
unstable-tag:
|
||
description: Docker tag for rolling/rawhide/sid version (e.g., rolling, rawhide, sid)
|
||
required: true
|
||
|
||
outputs:
|
||
# Previous version outputs
|
||
previous-tag:
|
||
description: Previous Docker tag (resolved — the derived tag when `auto` was requested)
|
||
value: ${{ steps.resolve-previous.outputs.tag }}
|
||
previous-version:
|
||
description: Previous OS version (e.g., 22.04, 41, 12)
|
||
value: ${{ steps.previous.outputs.version }}
|
||
previous-python:
|
||
description: Previous native Python version (e.g., 3.10)
|
||
value: ${{ steps.previous.outputs.python-version }}
|
||
previous-codename:
|
||
description: Previous OS codename (e.g., jammy, bookworm)
|
||
value: ${{ steps.previous.outputs.codename }}
|
||
|
||
# Latest version outputs
|
||
latest-tag:
|
||
description: Latest Docker tag (passed through)
|
||
value: ${{ inputs.latest-tag }}
|
||
latest-version:
|
||
description: Latest OS version (e.g., 24.04, 42, 13)
|
||
value: ${{ steps.latest.outputs.version }}
|
||
latest-python:
|
||
description: Latest native Python version (e.g., 3.12)
|
||
value: ${{ steps.latest.outputs.python-version }}
|
||
latest-codename:
|
||
description: Latest OS codename (e.g., noble, trixie)
|
||
value: ${{ steps.latest.outputs.codename }}
|
||
|
||
# Unstable version outputs
|
||
unstable-tag:
|
||
description: Unstable Docker tag (passed through)
|
||
value: ${{ inputs.unstable-tag }}
|
||
unstable-version:
|
||
description: Unstable OS version (e.g., 25.04, rawhide, sid)
|
||
value: ${{ steps.unstable.outputs.version }}
|
||
unstable-python:
|
||
description: Unstable native Python version (e.g., 3.13)
|
||
value: ${{ steps.unstable.outputs.python-version }}
|
||
unstable-codename:
|
||
description: Unstable OS codename (e.g., oracular, sid)
|
||
value: ${{ steps.unstable.outputs.codename }}
|
||
|
||
runs:
|
||
using: composite
|
||
steps:
|
||
# Latest is detected first because `auto` previous is derived from it.
|
||
- name: Detect latest version info
|
||
id: latest
|
||
uses: ./.forgejo/actions/detect-os-version
|
||
with:
|
||
os-type: ${{ inputs.os-name }}
|
||
os-tag: ${{ inputs.latest-tag }}
|
||
|
||
- name: Resolve previous tag
|
||
id: resolve-previous
|
||
shell: bash
|
||
run: |
|
||
# Ubuntu/Fedora publish no rolling "previous" tag (unlike Debian's `oldstable`),
|
||
# so `auto` derives it from the just-detected latest release. Both cadences are
|
||
# regular: Ubuntu LTS is X.04 every two years (previous = X-2), Fedora is
|
||
# sequential integers (previous = N-1). Any other value passes straight through.
|
||
REQUESTED="${{ inputs.previous-tag }}"
|
||
if [ "${REQUESTED}" != "auto" ]; then
|
||
echo "tag=${REQUESTED}" >> "$GITHUB_OUTPUT"
|
||
echo "📌 ${{ inputs.os-name }} previous pinned to '${REQUESTED}'"
|
||
exit 0
|
||
fi
|
||
LATEST="${{ steps.latest.outputs.version }}"
|
||
case "${{ inputs.os-name }}" in
|
||
ubuntu) TAG="$(( ${LATEST%%.*} - 2 )).04" ;;
|
||
fedora) TAG="$(( LATEST - 1 ))" ;;
|
||
*)
|
||
echo "::error::Cannot auto-derive previous tag for '${{ inputs.os-name }}' — pass an explicit tag"
|
||
exit 1
|
||
;;
|
||
esac
|
||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||
echo "🧮 ${{ inputs.os-name }} previous auto-derived from latest ${LATEST} → '${TAG}'"
|
||
|
||
- name: Detect previous version info
|
||
id: previous
|
||
uses: ./.forgejo/actions/detect-os-version
|
||
with:
|
||
os-type: ${{ inputs.os-name }}
|
||
os-tag: ${{ steps.resolve-previous.outputs.tag }}
|
||
|
||
- name: Detect unstable version info
|
||
id: unstable
|
||
uses: ./.forgejo/actions/detect-os-version
|
||
with:
|
||
os-type: ${{ inputs.os-name }}
|
||
os-tag: ${{ inputs.unstable-tag }}
|
||
|
||
- name: Log detected versions
|
||
shell: bash
|
||
run: |
|
||
echo "🔍 Detected versions for ${{ inputs.os-name }}:"
|
||
echo " Previous (${{ steps.resolve-previous.outputs.tag }}): ${{ steps.previous.outputs.version }} (Python ${{ steps.previous.outputs.python-version }})"
|
||
echo " Latest (${{ inputs.latest-tag }}): ${{ steps.latest.outputs.version }} (Python ${{ steps.latest.outputs.python-version }})"
|
||
echo " Unstable (${{ inputs.unstable-tag }}): ${{ steps.unstable.outputs.version }} (Python ${{ steps.unstable.outputs.python-version }})"
|