Skip to content

Commit

Permalink
Adapt publish script for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Jan 16, 2025
1 parent d93124a commit 7f1b557
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ if ! git diff-index --quiet HEAD --; then
exit 1
fi

if [ "$(git rev-parse --abbrev-ref HEAD)" != main ]; then
if [ "$(git rev-parse --abbrev-ref HEAD)" != v1/main ]; then
echo "error: requires main branch" >&2
exit 1
fi

# ensure we have the latest version tags
git fetch origin -pft

versions="$(git tag | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+')"
versions="$(git tag | grep '^v1\.[0-9]\+\.[0-9]\+')"
v_latest="$(npx -- semver --include-prerelease $versions | tail -n1)"

_is_prerelease() {
Expand Down Expand Up @@ -45,7 +45,7 @@ fi

gum confirm "prepare draft release for $v_new?" || exit 1

git push origin main
git push origin v1/main

is_prerelease=$(_is_prerelease $v_new)

Expand All @@ -55,14 +55,15 @@ gh release create \
--prerelease=$is_prerelease \
--generate-notes \
--notes-start-tag=v$v_latest \
--latest=false \
--title=v$v_new

gh workflow run cd.yml --raw-field version="$v_new"
gh workflow run cd.yml --ref=v1/main --raw-field version="$v_new"
# ^^ infuriatingly does not tell us the ID of the run

gum spin --title 'sleeping 5s because GitHub API is slow' -- sleep 5

run_id=$(gh run list --json databaseId --workflow=cd.yml | jq '.[0].databaseId')
run_id=$(gh run list --json databaseId --branch=v1/main --workflow=cd.yml | jq '.[0].databaseId')

if ! gh run watch --exit-status $run_id; then
foo=$?
Expand Down

0 comments on commit 7f1b557

Please sign in to comment.