Skip to content

Commit

Permalink
chore: fix release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed Dec 20, 2024
1 parent 3e9663d commit 2380d8f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
publish: 'yarn changeset publish'
version: yarn changeset version
publish: yarn changeset publish
commit: 'chore: version package'
title: 'chore: version package'
createGithubReleases: true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"type": "module",
"scripts": {
"changeset": "./scripts/changeset.sh",
"codegen": "tsx scripts/liblab-gen.ts",
"build:docs": "tsx scripts/liblab-docs.ts",
"postversion": "tsx scripts/update-version.ts"
"build:docs": "tsx scripts/liblab-docs.ts"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
Expand Down
27 changes: 27 additions & 0 deletions scripts/changeset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# make sure the script runs relative to the repo root
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.."

# some helpers and error handling:
info() { printf "%s\n" "$*" >&1; }
error() { printf "%s\n" "$*" >&2; }
trap 'echo Changeset interrupted >&2; exit 2' INT TERM

# pass all arguments to changeset
./node_modules/.bin/changeset "$@"

changeset_exit=$?
if [ ${changeset_exit} -gt 0 ];
then
error "Changeset finished with error"
exit ${changeset_exit}
fi

# if first argument was `version` also run the `update-version.ts` script
args=("$@")
info "args: ${args[@]}"
if [ $# -gt 0 ] && [ ${args[0]} = "version" ]
then
yarn tsx scripts/update-version.ts
fi

0 comments on commit 2380d8f

Please sign in to comment.