Skip to content

Commit

Permalink
fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Sep 10, 2023
1 parent 45c2e34 commit c8996fc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ jobs:
- run: tar cJf $FILENAME.tar.xz $FILENAME
- name: attach srcs to release
run: gh release upload
${{ github.event.inputs.version }}
$FILENAME.tar.xz
v${{ github.event.inputs.version }}
../$FILENAME.tar.xz
working-directory:
${{ env.FILENAME }}
env:
# using this token rather than github.token due to `release not found` bug
# https://github.com/cli/cli/issues/5252
GH_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- uses: actions/upload-artifact@v3
with:
name: srcs
Expand Down Expand Up @@ -70,7 +76,7 @@ jobs:
name: srcs

- run: tar xJf tea-${{ github.event.inputs.version }}.tar.xz --strip-components=1
- run: teaxyz/setup@v0
- uses: teaxyz/setup@v0
- run: deno task compile

- uses: teaxyz/brewkit/actions/setup-codesign@v0
Expand Down Expand Up @@ -108,3 +114,8 @@ jobs:
run: gh release upload
${{ github.event.inputs.version }}
$FILENAME $FILENAME.asc
env:
# using this token rather than github.token due to `release not found` bug
# https://github.com/cli/cli/issues/5252
GH_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
GH_REPO: teaxyz/cli
3 changes: 2 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 15 additions & 18 deletions scripts/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ v_latest="$(npx -- semver --include-prerelease $versions | tail -n1)"
is_prerelease() {
deno run - <<EoTS
import { parse } from "https://deno.land/x/semver/mod.ts";
console.log(parse('$1')?.prerelease.length ? 'true' : 'false);
console.log(parse('$1')?.prerelease.length ? 'true' : 'false');
EoTS
}

Expand All @@ -38,39 +38,36 @@ major|minor|patch|prerelease)
;;
esac

if is_prerelease $v_new; then
prerelease=true
else
prerelease=false
fi

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

git push origin main

gh release create \
v$v_new \
--draft=true \
--prelease=$(is_prerelease $v_new) \
--prerelease=$(is_prerelease $v_new) \
--generate-notes \
--notes-start-tag=$v_latest \
--title=$v_new \
--tag=$v_new \
--discussion-category=Announcements
--notes-start-tag=v$v_latest \
--title=$v_new

gh workflow run cd.yml -f version="$v_new"
# ^^ infuriatingly does not tell us the ID of the run

run_id=$(gh run list --json databaseId --workflow cd | jq '.[0].databaseId')
gum spin --title 'sleeping 5s because GitHub API is slow' -- sleep 5

gh workflow view --web $run_id
run_id=$(gh run list --json databaseId --workflow=cd.yml | jq '.[0].databaseId')

gum format -- "> gh run view --web $run_id"

gh run watch --exit-status $run_id

gum confirm "draft prepared, release $v_new?" || exit 1

gh release edit \
--verify-tag \
--tag $v_new \
--tag v$v_new \
--latest \
--draft=false
--draft=false \
--discussion-category=Announcements

gh release view $v_new --web
gh release view v$v_new --web

0 comments on commit c8996fc

Please sign in to comment.