fangorn/ex_git_objectstore
public
ref:main
release cancelled
Command:
set -e
apt-get update && apt-get install -y --no-install-recommends git jq curl
git config --global --add safe.directory /workspace
export MIX_HOME=/workspace/.mix
# Only release from main branch
# CI checks out a detached HEAD so git branch name is always "HEAD".
# Compare the checked-out SHA against origin/main instead.
git fetch origin main 2>/dev/null || true
HEAD_SHA=$(git rev-parse HEAD)
MAIN_SHA=$(git rev-parse origin/main 2>/dev/null || echo "")
if [ "$HEAD_SHA" != "$MAIN_SHA" ]; then
echo "Skipping release: HEAD ($HEAD_SHA) != origin/main ($MAIN_SHA)"
exit 0
fi
# Install anvil CLI. /runner/download serves the unified
# anvil/anvil-runner binary (fangorn/anvil#49 merged the two).
curl -sL "https://anvil.fangorn.io/runner/download?os=$(uname -s)&arch=$(uname -m)" -o /usr/local/bin/anvil
chmod +x /usr/local/bin/anvil
# Credentials are auto-injected by the runner: ANVIL_TOKEN is a
# per-job API token generated at dispatch and auto-revoked when
# this job finishes, and ANVIL_SERVER_URL points at the server
# that dispatched us. Both are part of the job environment; we
# don't need to set up any secrets manually.
#
# The scopes granted to that token are controlled by org/repo
# CI-permission settings — for this repo's release step to work,
# an admin must grant `releases: write` via:
# PUT /api/v1/fangorn/ex_git_objectstore/ci/permissions
# See fangorn/anvil#46 for the full design.
#
# `anvil auth status` fails loud if the runner didn't inject the
# token, if it's malformed, or if the server rejects it — which
# is exactly what we want before `anvil release create` tries to
# use it downstream.
/usr/local/bin/anvil auth status
# Compute CalVer version
VERSION=$(bash ci/release.sh)
echo "Releasing version: $VERSION"
# Idempotency: skip if this version tag already exists
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION already exists, skipping release"
exit 0
fi
# Build with version
export VERSION
mix compile
# Generate changelog from commits since last tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || git rev-list --max-parents=0 HEAD)
CHANGELOG=$(git log --oneline "$LAST_TAG"..HEAD)
# Generate docs
mix docs
tar czf ex_git_objectstore-${VERSION}-docs.tar.gz doc/
# Create Anvil release
anvil release create \
--tag "$VERSION" \
--title "ExGitObjectstore $VERSION" \
--body "$CHANGELOG"
# Tag and push. The runner clones via an auto-embedded clone
# token in origin, which only has read access — `git push origin`
# would 401. Push via an explicit URL that embeds the job API
# token (ANVIL_TOKEN) so auth goes through the repo's
# contents:write scope (see fangorn/anvil#46 / #59).
git tag "$VERSION"
git push \
"https://x-token:${ANVIL_TOKEN}@anvil.fangorn.io/fangorn/ex_git_objectstore.git" \
"$VERSION"
echo "Released $VERSION"
Started: -
Completed: Apr 18, 2026 at 15:32 UTC
Duration: -
Build Output
No output yet.