Adopt native ReleaseKit delivery workflow
This commit is contained in:
@@ -1,57 +1,55 @@
|
|||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- GO_IMAGE: golang:1.27.4-bookworm
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- event: tag
|
- event: tag
|
||||||
|
ref: refs/tags/v*
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-release-assets
|
- name: deliver
|
||||||
image: golang:1.27.4
|
image: ${GO_IMAGE}
|
||||||
|
environment:
|
||||||
|
RELEASEKIT_GITEA_TOKEN:
|
||||||
|
from_secret: releasekit_gitea_token
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
|
test -n "$${CI_COMMIT_TAG}"
|
||||||
export GOTOOLCHAIN=local
|
test -n "$${CI_COMMIT_SHA}"
|
||||||
|
git check-ref-format "refs/tags/$${CI_COMMIT_TAG}"
|
||||||
version="$CI_COMMIT_TAG"
|
git fetch origin "refs/tags/$${CI_COMMIT_TAG}:refs/tags/$${CI_COMMIT_TAG}"
|
||||||
revision="$CI_COMMIT_SHA"
|
tag_commit=$(git rev-parse --verify "refs/tags/$${CI_COMMIT_TAG}^{commit}")
|
||||||
dist="dist"
|
expected_commit=$(git rev-parse --verify "$${CI_COMMIT_SHA}^{commit}")
|
||||||
pkg="gitea.maximumdirect.net/eric/scriptorium/cmd/scriptorium"
|
if [ "$${tag_commit}" != "$${expected_commit}" ]; then
|
||||||
notes="docs/releases/$version.md"
|
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
|
||||||
if [ ! -f "$notes" ]; then
|
|
||||||
printf 'release notes not found: %s\n' "$notes" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
git checkout --detach "$${tag_commit}"
|
||||||
|
test "$(git rev-parse HEAD | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
|
||||||
|
test -z "$(git status --porcelain --untracked-files=all)"
|
||||||
|
|
||||||
rm -rf "$dist"
|
bootstrap_dir=$(mktemp -d "$${CI_WORKSPACE%/*}/.releasekit-bootstrap.XXXXXX")
|
||||||
mkdir -p "$dist"
|
trap 'rm -rf "$${bootstrap_dir}"' EXIT
|
||||||
cp "$notes" "$dist/RELEASE_NOTES.md"
|
cp go.mod "$${bootstrap_dir}/releasekit.mod"
|
||||||
|
if [ -f go.sum ]; then
|
||||||
|
cp go.sum "$${bootstrap_dir}/releasekit.sum"
|
||||||
|
else
|
||||||
|
: > "$${bootstrap_dir}/releasekit.sum"
|
||||||
|
fi
|
||||||
|
|
||||||
build_binary() {
|
export GOWORK=off
|
||||||
goos="$1"
|
export GOTOOLCHAIN=local
|
||||||
goarch="$2"
|
releasekit_host_os=$(go env GOHOSTOS) || exit $?
|
||||||
suffix="$3"
|
releasekit_host_arch=$(go env GOHOSTARCH) || exit $?
|
||||||
output="$dist/scriptorium-$version-$goos-$goarch$suffix"
|
export GOOS="$${releasekit_host_os}" GOARCH="$${releasekit_host_arch}"
|
||||||
|
releasekit_module=go.maximumdirect.net/releasekit
|
||||||
CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" \
|
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -m "$${releasekit_module}"
|
||||||
go build -trimpath -ldflags "-s -w -X main.version=$version -X main.revision=$revision" \
|
go mod edit -modfile="$${bootstrap_dir}/releasekit.mod" -tool="$${releasekit_module}/cmd/releasekit"
|
||||||
-o "$output" "$pkg"
|
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}" \
|
||||||
build_binary linux amd64 ""
|
--prepared \
|
||||||
build_binary linux arm64 ""
|
--commit "$${expected_commit}" \
|
||||||
|
"$${CI_COMMIT_TAG}"
|
||||||
- name: publish-release
|
|
||||||
image: woodpeckerci/plugin-release
|
|
||||||
depends_on:
|
|
||||||
- build-release-assets
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: GITEA_RELEASE_TOKEN
|
|
||||||
files:
|
|
||||||
- dist/scriptorium-*
|
|
||||||
note: dist/RELEASE_NOTES.md
|
|
||||||
checksum: sha256
|
|
||||||
checksum-file: SHA256SUMS
|
|
||||||
checksum-flatten: true
|
|
||||||
file-exists: skip
|
|
||||||
overwrite: false
|
|
||||||
prerelease: false
|
|
||||||
|
|||||||
@@ -190,6 +190,13 @@ root `releasekit_test.go`; delete `scripts/release.sh` and
|
|||||||
|
|
||||||
## Stage 3: Adopt The Native Woodpecker Delivery Workflow
|
## Stage 3: Adopt The Native Woodpecker Delivery Workflow
|
||||||
|
|
||||||
|
**Completed:** The workflow matches the pinned template byte-for-byte; its
|
||||||
|
YAML parsed and its unescaped shell block passed syntax checking. In an
|
||||||
|
annotated-tag fixture with a local-only origin, the actual block reached the
|
||||||
|
native missing-token error (status 2) without hosted access. Tagged module
|
||||||
|
files remained unchanged and temporary bootstrap metadata was removed. This
|
||||||
|
does not demonstrate hosted delivery.
|
||||||
|
|
||||||
**Primary file:** `.woodpecker/release.yml`.
|
**Primary file:** `.woodpecker/release.yml`.
|
||||||
|
|
||||||
### Work
|
### Work
|
||||||
|
|||||||
Reference in New Issue
Block a user