Files
git-workflows/.gitea/scoped_workflows/release.yml
T
Tirsvad 78bcde15b6
TirSystem/git-workflows: OpenGrep / opengrep (push) Skipped
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Skipped
TirSystem/git-workflows: Publish accepted milestones / publish (push) Skipped
TirSystem/git-workflows: Validate / validate (push) Skipped
TirSystem/git-workflows: Release / release (pull_request) Successful in 27s
TirSystem/git-workflows: Validate / validate (pull_request) Successful in 51s
Validate workflows / validate (pull_request) Successful in 1m42s
TirSystem/git-workflows: OpenGrep / opengrep (pull_request) Successful in 3m24s
Read the release version from the changelog
The release workflow has no form when it is started by hand: the version
is the newest numbered entry of CHANGELOG.md. The inputs version and
dry_run are removed; the changelog check of a pull request replaces the
dry run.

Task: MIL-018#4
2026-11-05 23:00:50 +08:00

60 lines
2.3 KiB
YAML

name: Release
# Scoped workflow (ADR-0017): it is started by hand in any repository of an
# organization, with no form. The version is read from CHANGELOG.md: the newest
# numbered entry. It creates the version tag, the release page from that entry
# and, from 1.0.0, moves the major tag, and only when the commit is the tip of
# the default branch, its run "Validate / validate (push)" is green and the tag
# does not exist yet. What a release is checked against is the changelog, which
# the pull request check below keeps releasable.
# It requires the organization secret TOKEN_FOR_GITEA_RELEASE and has no
# fallback to the token of the run or to any other secret. The script is a file
# of TirSystem/git-workflows (tools/release.py), fetched at v3.
#
# A pull request also runs it, as a check that writes nothing and needs no
# secret: the changelog follows the convention, so the next release can be cut
# from it. Its status is "Release / release (pull_request)" and can be a
# required check of the default branch. A repository without CHANGELOG.md ends
# green.
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ gitea.event_name == 'pull_request' && format('release-check-{0}', gitea.ref) || 'release' }}
cancel-in-progress: false
jobs:
release:
name: release
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out the repository
uses: actions/checkout@v4.2.2
- name: Fetch the shared script
uses: actions/checkout@v4.2.2
with:
repository: TirSystem/git-workflows
ref: v3
path: shared-scripts
- name: Check the changelog of the pull request
if: gitea.event_name == 'pull_request'
run: |
[ -f CHANGELOG.md ] || { echo "No CHANGELOG.md in this repository; nothing to check."; exit 0; }
python3 shared-scripts/tools/changelog.py check
- name: Check and publish the release
if: gitea.event_name == 'workflow_dispatch'
env:
GITEA_API_URL: ${{ gitea.api_url }}
SOURCE_REPOSITORY: ${{ gitea.repository }}
RELEASE_CREDENTIALS: ${{ secrets.TOKEN_FOR_GITEA_RELEASE }}
RELEASE_DRY_RUN: "false"
RELEASE_SHA: ${{ gitea.sha }}
run: python3 shared-scripts/tools/release.py