Use ReleaseKit for tag delivery
This commit is contained in:
@@ -1,39 +1,56 @@
|
|||||||
|
# Adapted from ReleaseKit v0.10.0 tag-delivery.yml.
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- GO_IMAGE: golang:1.27.4-bookworm
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- event: tag
|
- event: tag
|
||||||
|
ref: refs/tags/v*
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
validate-release:
|
- name: deliver
|
||||||
image: golang:1.27.4
|
image: ${GO_IMAGE}
|
||||||
commands:
|
environment:
|
||||||
- ./scripts/check-release-candidate.sh "$CI_COMMIT_TAG"
|
RELEASEKIT_GITEA_TOKEN:
|
||||||
|
from_secret: GITEA_RELEASE_TOKEN
|
||||||
build-release-assets:
|
|
||||||
image: golang:1.27.4
|
|
||||||
depends_on:
|
|
||||||
- validate-release
|
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
case "$PWD" in
|
test -n "$${CI_COMMIT_TAG}"
|
||||||
/*) ;;
|
test -n "$${CI_COMMIT_SHA}"
|
||||||
*) echo "release workspace must have an absolute path" >&2; exit 1 ;;
|
git check-ref-format "refs/tags/$${CI_COMMIT_TAG}"
|
||||||
esac
|
git fetch origin "refs/tags/$${CI_COMMIT_TAG}:refs/tags/$${CI_COMMIT_TAG}"
|
||||||
./scripts/build-release-assets.sh "$CI_COMMIT_TAG" "$PWD/dist"
|
tag_commit=$(git rev-parse --verify "refs/tags/$${CI_COMMIT_TAG}^{commit}")
|
||||||
|
expected_commit=$(git rev-parse --verify "$${CI_COMMIT_SHA}^{commit}")
|
||||||
|
if [ "$${tag_commit}" != "$${expected_commit}" ]; then
|
||||||
|
printf 'Tag %s resolves to commit %s; event %s resolves to commit %s\n' \
|
||||||
|
"$${CI_COMMIT_TAG}" "$${tag_commit}" "$${CI_COMMIT_SHA}" "$${expected_commit}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git checkout --detach "$${tag_commit}"
|
||||||
|
test "$(git rev-parse HEAD | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
|
||||||
|
test -z "$(git status --porcelain --untracked-files=all)"
|
||||||
|
|
||||||
publish-release:
|
bootstrap_dir=$(mktemp -d "$${CI_WORKSPACE%/*}/.releasekit-bootstrap.XXXXXX")
|
||||||
image: woodpeckerci/plugin-release:0.3.1
|
trap 'rm -rf "$${bootstrap_dir}"' EXIT
|
||||||
depends_on:
|
cp go.mod "$${bootstrap_dir}/releasekit.mod"
|
||||||
- build-release-assets
|
if [ -f go.sum ]; then
|
||||||
settings:
|
cp go.sum "$${bootstrap_dir}/releasekit.sum"
|
||||||
api_key:
|
else
|
||||||
from_secret: GITEA_RELEASE_TOKEN
|
: > "$${bootstrap_dir}/releasekit.sum"
|
||||||
files:
|
fi
|
||||||
- dist/narratio-*
|
|
||||||
title: Narratio ${CI_COMMIT_TAG}
|
export GOWORK=off
|
||||||
note: docs/releases/${CI_COMMIT_TAG}.md
|
export GOTOOLCHAIN=local
|
||||||
checksum: sha256
|
releasekit_host_os=$(go env GOHOSTOS) || exit $?
|
||||||
checksum-file: SHA256SUMS
|
releasekit_host_arch=$(go env GOHOSTARCH) || exit $?
|
||||||
checksum-flatten: true
|
export GOOS="$${releasekit_host_os}" GOARCH="$${releasekit_host_arch}"
|
||||||
file-exists: skip
|
releasekit_module=go.maximumdirect.net/releasekit
|
||||||
overwrite: false
|
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -m "$${releasekit_module}"
|
||||||
prerelease: false
|
go mod edit -modfile="$${bootstrap_dir}/releasekit.mod" -tool="$${releasekit_module}/cmd/releasekit"
|
||||||
|
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -deps "$${releasekit_module}/cmd/releasekit" > /dev/null
|
||||||
|
go tool -modfile="$${bootstrap_dir}/releasekit.mod" "$${releasekit_module}/cmd/releasekit" ci-deliver \
|
||||||
|
--repo "$${CI_WORKSPACE}" \
|
||||||
|
--prepared \
|
||||||
|
--commit "$${expected_commit}" \
|
||||||
|
"$${CI_COMMIT_TAG}"
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ entry point for native subcommands.
|
|||||||
|
|
||||||
## Stage 3 — Adopt the upstream Woodpecker delivery workflow
|
## Stage 3 — Adopt the upstream Woodpecker delivery workflow
|
||||||
|
|
||||||
Status: pending.
|
Status: completed. Adopted the v0.10.0 root-module template with the existing
|
||||||
|
secret mapping and source comment. Compared it directly with the pinned template;
|
||||||
|
live CI and the obsolete workflow tests were not run at this boundary.
|
||||||
|
|
||||||
Read `.woodpecker/release.yml`, the v0.10.0 root-module tag-delivery template,
|
Read `.woodpecker/release.yml`, the v0.10.0 root-module tag-delivery template,
|
||||||
and the upstream delivery guide's Woodpecker section.
|
and the upstream delivery guide's Woodpecker section.
|
||||||
|
|||||||
Reference in New Issue
Block a user