64 lines
2.6 KiB
YAML
64 lines
2.6 KiB
YAML
when:
|
|
- event: tag
|
|
ref:
|
|
include:
|
|
- refs/tags/v[01].*
|
|
- refs/tags/integrations/ckconfig/v*
|
|
- refs/tags/integrations/core/v2.*
|
|
|
|
steps:
|
|
- name: deliver
|
|
image: golang:1.26.8-bookworm
|
|
environment:
|
|
RELEASEKIT_GITEA_TOKEN:
|
|
from_secret: releasekit_gitea_token
|
|
commands:
|
|
- |
|
|
set -eu
|
|
test -n "$${CI_COMMIT_TAG}"
|
|
test -n "$${CI_COMMIT_SHA}"
|
|
git check-ref-format "refs/tags/$${CI_COMMIT_TAG}"
|
|
git fetch origin "refs/tags/$${CI_COMMIT_TAG}:refs/tags/$${CI_COMMIT_TAG}"
|
|
tag_commit=$(git rev-parse --verify "refs/tags/$${CI_COMMIT_TAG}^{commit}")
|
|
expected_commit=$(printf '%s' "$${CI_COMMIT_SHA}" | tr '[:upper:]' '[:lower:]')
|
|
test "$(printf '%s' "$${tag_commit}" | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
|
|
git checkout --detach "$${tag_commit}"
|
|
test "$(git rev-parse HEAD | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
|
|
test -z "$(git status --porcelain --untracked-files=all)"
|
|
|
|
bootstrap_dir=$(mktemp -d "$${CI_WORKSPACE%/*}/.releasekit-bootstrap.XXXXXX")
|
|
trap 'rm -rf "$${bootstrap_dir}"' EXIT
|
|
selection_file="$${bootstrap_dir}/module-selection.tsv"
|
|
"$${CI_WORKSPACE}/select-module.sh" tag "$${CI_COMMIT_TAG}" > "$${selection_file}"
|
|
tab=$(printf '\t')
|
|
IFS="$${tab}" read -r selector tag_pattern module_dir profile_path < "$${selection_file}"
|
|
module_path="$${CI_WORKSPACE}"
|
|
if [ "$${module_dir}" != . ]; then
|
|
module_path="$${CI_WORKSPACE}/$${module_dir}"
|
|
fi
|
|
cp "$${module_path}/go.mod" "$${bootstrap_dir}/go.mod"
|
|
if [ -f "$${module_path}/go.sum" ]; then
|
|
cp "$${module_path}/go.sum" "$${bootstrap_dir}/go.sum"
|
|
else
|
|
: > "$${bootstrap_dir}/go.sum"
|
|
fi
|
|
cp "$${bootstrap_dir}/go.mod" "$${bootstrap_dir}/releasekit.mod"
|
|
cp "$${bootstrap_dir}/go.sum" "$${bootstrap_dir}/releasekit.sum"
|
|
|
|
export GOWORK=off
|
|
export GOTOOLCHAIN=local
|
|
releasekit_module=gitea.maximumdirect.net/eric/ReleaseKit
|
|
(
|
|
cd "$${module_path}"
|
|
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -m "$${releasekit_module}"
|
|
go build -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" \
|
|
-o "$${bootstrap_dir}/releasekit" "$${releasekit_module}/cmd/releasekit"
|
|
)
|
|
"$${bootstrap_dir}/releasekit" ci-deliver \
|
|
--repo "$${CI_WORKSPACE}" \
|
|
--config "$${profile_path}" \
|
|
--expected-module "$${module_dir}" \
|
|
--prepared \
|
|
--commit "$${CI_COMMIT_SHA}" \
|
|
"$${CI_COMMIT_TAG}"
|