A collection of shared GitHub Actions reusable workflows for the Replworks organization.
| Workflow | Purpose | Trigger |
|---|---|---|
update-changelog.yml |
Updates CHANGELOG.md from the release notes and commits it to the release target branch |
release: published (in the calling repo) |
update-major-tag.yml |
Moves the major tag (e.g. v1) to the newly published release |
release: published (in this repo) |
Create .github/workflows/changelog.yml in each repository and use one of the two variants below, depending on the runner.
name: Changelog
on:
release:
types: [published]
jobs:
changelog:
uses: replworks/.github/.github/workflows/update-changelog.yml@v1
permissions:
contents: writeIf runs-on is omitted, it defaults to ubuntu-latest.
name: Changelog
on:
release:
types: [published]
jobs:
changelog:
uses: replworks/.github/.github/workflows/update-changelog.yml@v1
with:
runs-on: '["self-hosted", "linux", "arm64"]'
permissions:
contents: write| Name | Type | Default | Description |
|---|---|---|---|
runs-on |
string (JSON) | '"ubuntu-latest"' |
Runner selection. Pass it as a JSON string. |
runs-on examples:
- GitHub-hosted: omit it, or use
'"ubuntu-latest"' - Self-hosted:
'["self-hosted", "linux", "arm64"]'
- The caller must grant
permissions: contents: writeitself. A reusable workflow cannot have more permissions than its caller. - Only
GITHUB_TOKENis used, sosecrets: inheritis not needed. - If the release's
target_commitishis notmainormaster, the major version of the tag must match the major version of the branch. If they differ, the workflow fails on purpose.
- Releases are created with concrete versions such as
v1.0.0andv1.1.0(GitHub Releases). - Callers reference the major tag
@v1.v1is a moving tag that points to the latestv1.x.yrelease. - Callers do not need to change their files when the workflow is updated. Only breaking changes bump the major version to
v2.
- Push the change to
mainand verify it. - Create a
v1.x.yRelease on GitHub.
That's it. When the Release is published, update-major-tag.yml moves the major tag (v1) to the new release automatically. Publishing v2.0.0 creates the v2 tag the same way.
Notes:
- The major tag is derived from the release tag by cutting everything after the first
., so release tags must look likevMAJOR.MINOR.PATCH. - Pre-releases (e.g.
v1.2.0-rc.1) do not move the major tag. - If a tag ruleset blocks force pushes to tags, the workflow fails. Allow it for
v*tags or move the tag manually:
git fetch --tags
git tag -f v1 v1.x.y
git push origin v1 --forceThe update-major-tag.yml workflow only runs for releases published after it landed on main. For the very first release, if the v1 tag does not exist yet, create it with the commands above. Without the v1 tag, calls to @v1 will fail.
Creating a Release in this repo does not update any CHANGELOG, because this repo has no workflow that calls
update-changelog. The only workflow that runs on release here isupdate-major-tag.yml.
- If this repo is private, enable "Accessible from repositories in the organization" under Settings → Actions → General → Access. (Not needed if the repo is public.)
- For repos using self-hosted runners, the runner must be registered at the organization level. If it is registered only at the repo level, only that repo can use it.
gitmust be installed on the runner machine.- The release date extraction uses GNU
date(date -d @...), so it does not work on macOS (BSDdate) runners. Use a Linux runner.
- Reusable workflow instead of copies: Copying the yml into every repo means chasing each copy whenever it changes. Keeping it in one place and calling it with
usesapplies a change everywhere at once. (Theworkflow-templatesapproach creates copies, so changes to the original do not reach repos that already copied it.) runs-onas an input: Keeps the GitHub-hosted and self-hosted variants in a single file instead of two. The difference only shows up in the caller'swithblock.@v1instead of@main: Acts as a buffer so that a brokenmaindoes not immediately spread to every repo. Verify onmain, then publish a Release.- Release + moving major tag: Releases make the version name visible on the repo's main page, and moving
v1lets updates reach callers without editing their files. - Major tag moved by a workflow: Moving
v1by hand is an easy step to forget, and a forgotten step means callers silently keep running the old version.update-major-tag.ymlmakes publishing a Release the only manual step. - Actions referenced by tag, not SHA: Upstream bug fixes are picked up automatically. The trade-off is that tags can be moved to a different commit, so a compromised third-party action would run with
contents: writepermission. We accept that risk. - Release date taken from the tag's commit: The date in the changelog should be the UTC date of the commit the tag points to, so it is extracted directly with
git log. - Values passed through
env:${{ ... }}expressions are not interpolated directly into shell scripts; they are passed viaenvinstead.