foundation/actions/semantic-release-version/action.yml
Andreas Niemann 35dc008759
All checks were successful
CI / preflight (push) Successful in 5s
CI / typecheck (push) Successful in 15s
ecosystem-selftest / semantic-release-bumptest (push) Successful in 13s
ecosystem-selftest / eslint-gate (push) Successful in 3s
ecosystem-selftest / yamllint-gate (push) Successful in 3s
pulumi-preview / preview (push) Successful in 16s
refactor(ci): composite actions instead of reusable workflows (Forgejo 11)
Forgejo 11.0.15 does NOT support reusable workflows (job-level `uses:` /
`workflow_call`): the call is silently dropped and no run is scheduled (verified
live — a same-repo and a cross-repo reusable call both produced zero runs, while
an equivalent inline job ran green). The working cross-repo reuse primitive here
is the COMPOSITE ACTION referenced by FULL URL (a short-form
`uses: olsitec/foundation/...@master` resolves against the runner's
DEFAULT_ACTIONS_URL = data.forgejo.org, not the local instance, and 404s; the
full-URL form `uses: https://forge.olsitec.net/olsitec/foundation/actions/<x>@master`
was verified green).

- Replace the four reusable-*.yml with composite actions under actions/:
  node-build, docker-build, lint, semantic-release-version (same logic + inputs).
- actions/README.md documents the pattern, the Forgejo-11 limitation, and the
  999_testing candidate coverage (C2/C3/C4 self-contained; C1/C5 blocked on the
  not-yet-published @olsitec package registry).
- ecosystem-selftest paths filter: actions/** (was reusable-*.yml).

The capabilities that need no external repo (semantic-release bump sequence,
eslint/yamllint gates) keep running green via ecosystem-selftest's inline jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:14:51 +02:00

71 lines
3 KiB
YAML

# semantic-release-version — compute the next semver from conventional commits
# (999_testing "semantic-release testing"). Composite action (see actions/node-build).
# Mirrors the canonical GitLab template (olsitec/gitlab ci_templates/release-automation/
# semantic-release.yaml): conventionalcommits preset + Olsitec's releaseRules, run as a
# `--dry-run --no-ci --tag-format '${version}'` probe. Outputs the computed version.
#
# jobs:
# version:
# runs-on: docker
# container: { image: foundation-ci:latest }
# outputs: { version: "${{ steps.sr.outputs.version }}" }
# steps:
# - uses: actions/checkout@v4
# with: { fetch-depth: 0 } # REQUIRED: full history + tags
# - id: sr
# uses: https://forge.olsitec.net/olsitec/foundation/actions/semantic-release-version@master
#
# NOTE: dry-run version compute only (the part 999_testing checks + the GitLab
# `generate-release-version` job). Publishing a Forgejo release is deferred (no
# @semantic-release/forgejo analogue yet).
name: semantic-release-version
description: Compute the next semantic-release version (dry-run) from conventional commits.
inputs:
branch:
default: master
outputs:
version:
description: "next release version (empty if the commits warrant no release)"
value: ${{ steps.compute.outputs.version }}
runs:
using: composite
steps:
- name: Write .releaserc.yaml (Olsitec conventionalcommits ruleset)
shell: bash
run: |
cat > .releaserc.yaml <<'EOF'
branches:
- name: ${{ inputs.branch }}
tagFormat: "${version}"
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
releaseRules:
- { breaking: true, release: major }
- { type: breaking, release: major }
- { type: feature, release: minor }
- { type: feat, release: minor }
- { type: fix, release: patch }
- { type: build, release: patch }
- { type: chore, release: patch }
- { type: ci, release: patch }
- { type: docs, release: patch }
- { type: perf, release: patch }
- { type: refactor, release: patch }
- { type: style, release: patch }
- { type: test, release: patch }
parserOpts:
noteKeywords: [ "BREAKING CHANGE", "BREAKING CHANGES" ]
- "@semantic-release/release-notes-generator"
EOF
- name: Compute next version (dry-run)
id: compute
shell: bash
run: |
out=$(semantic-release --dry-run --no-ci --tag-format '${version}' --branches "${{ inputs.branch }}" 2>&1 || true)
printf '%s\n' "$out"
ver=$(printf '%s\n' "$out" \
| grep -oiE 'next release version is [0-9]+\.[0-9]+\.[0-9]+' \
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | tail -1)
echo "computed next version: ${ver:-<none>}"
echo "version=$ver" >> "$GITHUB_OUTPUT"