Files
computer-playbook/.github/workflows/release-version.yml
T
kevinveenbirkenbachandClaude Opus 4.7 f3845323f1 test(lint): cap inline literal script blocks at 12 logical lines + extract offenders
Add tests/lint/repository/test_inline_script_block_size.py: scans
roles/, tasks/, playbooks/ and .github/ YAML for literal block scalars
(`|` / `|-` / `|+`) following the keys `shell`, `command`, `script`,
`raw` (Ansible) and `run` (GitHub Actions). Counts logical lines —
trailing-`\` continuations collapse to one line, blank lines are
ignored — and fails when a block exceeds 12.

FOLDED scalars (`>` / `>-` / `>+`) are exempt: they are one shell
statement after YAML folding, even if they span many source lines for
readability.

The walk goes through `utils.cache.files.iter_project_files(...)` per
`docs/agents/action/testing.md` so the shared project-tree cache is
reused across the lint suite.

The fail message tells the author exactly how to fix: Ansible tasks
get the built-in `script:` module (collapses the task to one line);
GitHub Actions workflows extract into `scripts/github/<name>.sh` and
call it via `run: bash scripts/github/<name>.sh` (or
`_helpers/scripts/github/<name>.sh` when the workflow checks out the
repo into `_helpers/`).

Extract the pre-existing literal-block offenders so the new lint
ships green:

  Ansible (script: module, file under <role>/files/)
    web-app-friendica   sync_addon.sh
    web-app-fider       create_admin_user.sh
    web-app-fider       configure_oidc_provider.sh
    web-app-mediawiki   install_or_update.sh
    web-app-mediawiki   composer_install_extension.sh
    web-app-xwiki       debug_superadmin.sh

  GitHub Actions (scripts/github/)
    pick_distro.sh
    guard_release.sh
    resolve_release_inputs.sh
    disk_pressure_report.sh

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:42:44 +02:00

154 lines
4.7 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-release
cancel-in-progress: false
permissions:
contents: write
packages: write
security-events: write
actions: read
env:
REGISTRY: ghcr.io
DEFAULT_DISTRO: "debian"
jobs:
check-ci-images:
name: 🔎 Check CI images
runs-on: ubuntu-latest
outputs:
missing: ${{ steps.check.outputs.missing }}
ci_tag: ${{ steps.citag.outputs.ci_tag }}
distros: ${{ steps.vars.outputs.distros }}
repo_prefix: ${{ steps.vars.outputs.repo_prefix }}
owner: ${{ steps.vars.outputs.owner }}
version_tag: ${{ steps.vars.outputs.version_tag }}
publish_latest: ${{ steps.highest.outputs.publish_latest }}
steps:
- name: Checkout trusted workflow repo (helpers)
uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
path: _helpers
persist-credentials: false
- name: Resolve release inputs
id: vars
shell: bash
run: bash _helpers/scripts/github/resolve_release_inputs.sh "${{ inputs.tag || github.event.inputs.tag }}"
- name: Checkout repository at version tag
uses: actions/checkout@v6
with:
ref: ${{ steps.vars.outputs.version_tag }}
path: _src
fetch-depth: 0
fetch-tags: true
- name: Compute CI tag (ci-<sha> of version tag)
id: citag
shell: bash
run: |
set -euo pipefail
sha="$(git -C _src rev-parse HEAD)"
echo "ci_tag=ci-${sha}" >> "$GITHUB_OUTPUT"
- name: Decide whether this version should update latest
id: highest
shell: bash
env:
REPOSITORY_DIR: _src
VERSION_TAG: ${{ steps.vars.outputs.version_tag }}
run: _helpers/scripts/meta/resolve/publish_latest.sh
- name: Login to GHCR (manifest checks)
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check whether CI images already exist
id: check
shell: bash
env:
OWNER: ${{ steps.vars.outputs.owner }}
REPO_PREFIX: ${{ steps.vars.outputs.repo_prefix }}
DISTROS: ${{ steps.vars.outputs.distros }}
CI_TAG: ${{ steps.citag.outputs.ci_tag }}
run: |
set -euo pipefail
missing="$(_helpers/scripts/meta/resolve/missing/ci_images.sh)"
echo "missing=${missing}" >> "$GITHUB_OUTPUT"
build-ci-images-if-missing:
name: 🏗️ Build missing CI images
needs: check-ci-images
if: needs.check-ci-images.outputs.missing == 'true'
uses: ./.github/workflows/images-build-ci.yml
with:
distros: ${{ needs.check-ci-images.outputs.distros }}
checkout_ref: ${{ needs.check-ci-images.outputs.version_tag }}
image_tag: ${{ needs.check-ci-images.outputs.ci_tag }}
concurrency_channel: release-backfill
secrets: inherit
release:
name: 🚀 Release version
needs:
- check-ci-images
- build-ci-images-if-missing
if: |
always() &&
needs.check-ci-images.result == 'success' &&
(
needs.build-ci-images-if-missing.result == 'success' ||
needs.build-ci-images-if-missing.result == 'skipped'
)
runs-on: ubuntu-latest
env:
VERSION_TAG: ${{ needs.check-ci-images.outputs.version_tag }}
OWNER: ${{ needs.check-ci-images.outputs.owner }}
REPO_PREFIX: ${{ needs.check-ci-images.outputs.repo_prefix }}
DISTROS: ${{ needs.check-ci-images.outputs.distros }}
CI_TAG: ${{ needs.check-ci-images.outputs.ci_tag }}
PUBLISH_LATEST: ${{ needs.check-ci-images.outputs.publish_latest }}
steps:
- name: Checkout trusted workflow repo (helpers)
uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Retag CI images to release tags (and latest for the highest version)
shell: bash
run: scripts/image/release.sh