The same changes as the Actions workflows: a release gate runs `task check dist` and the dist step only packages; canary and promote copy archied out of archied:edge instead of compiling it. The gate and the pull-request check keep Go's module, build and lint caches on the host, in separate directories so a pull request cannot write into the cache a release build reads. Fixes: notes wait for the signed release and carry the prerelease flag; the canary clones with tags, which its rollback needs to diff migrations; release puts HEAD on main before `task release`, which refuses anything else.
54 lines
2.3 KiB
YAML
54 lines
2.3 KiB
YAML
# Manual release: turn [Unreleased] in CHANGELOG.md into a release commit, tag
|
|
# it, and push main and the tag in one command. The deploy pipeline publishes
|
|
# what this pushes, so this workflow commits and tags but never builds.
|
|
#
|
|
# Start it with the pipeline variable RELEASE=minor (or major, patch, or an
|
|
# exact 1.2.3): woodpecker-cli pipeline create --branch main --var RELEASE=minor
|
|
# sam/archie, or the same variable in the web UI's pipeline dialog.
|
|
#
|
|
# Shell-side references are written $$name (see the note in deploy.yaml).
|
|
#
|
|
# Requires repo secret deploy_token, a token that may push to main and to tags.
|
|
|
|
when:
|
|
- event: [manual]
|
|
|
|
# Two releases at once would read the same last tag and try to write it twice.
|
|
concurrency: 1
|
|
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git:2.8.0
|
|
settings:
|
|
# `task release` derives the next version from the release tags.
|
|
tags: true
|
|
fetch_target_branch: true
|
|
|
|
steps:
|
|
- name: cut
|
|
image: golang:1.27.3-bookworm
|
|
environment:
|
|
DEPLOY_TOKEN:
|
|
from_secret: deploy_token
|
|
commands:
|
|
- '[ -n "$$RELEASE" ] || { echo "RELEASE is empty: start this workflow with the pipeline variable RELEASE=major|minor|patch|x.y.z"; exit 1; }'
|
|
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the release cannot push its commit and tag"; exit 1; }'
|
|
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
|
- git config user.name "Sam Catlow"
|
|
- git config user.email "sam@catlow.tech"
|
|
# `task release` only cuts from a branch named main, and the clone can
|
|
# leave HEAD detached at main's tip.
|
|
- git checkout -q -B main
|
|
- task release RELEASE="$$RELEASE"
|
|
- |
|
|
set -eu
|
|
tag=$(git describe --exact-match --match 'v*' HEAD)
|
|
# HEAD, not a local main: the clone checks out the fetched ref detached,
|
|
# so there is no branch to name. The release commit is a child of main,
|
|
# so this is the fast-forward an atomic push needs.
|
|
#
|
|
# Gitea authenticates a token in the password position and ignores the
|
|
# user name, so the token never has to be a real login.
|
|
git push --atomic "https://x-access-token:$$DEPLOY_TOKEN@git.catlow.cloud/sam/archie.git" HEAD:refs/heads/main "$$tag"
|
|
echo "released $$tag"
|