Skip to content

Commit

Permalink
chore: fix lumina-node npm version bump on ci (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvolin authored Sep 24, 2024
1 parent d3a8a90 commit fa700aa
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,24 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
run: |
pr_branch_name=${{ steps.release-plz.outputs.pr.head_branch }}
set -eu
pr_branch_name="${{ fromJSON(steps.release-plz.outputs.pr).head_branch }}"
# switch to the branch created by release-plz
git fetch
git checkout "$pr_branch_name"
# Update the version of lumina-node-wasm dependency
node_wasm_version="$(cargo pkgid --manifest-path=node-wasm/Cargo.toml | cut -d@ -f 2)"
cd node-wasm/js
npm pkg set "dependencies[lumina-node-wasm]=$node_wasm_version"
# Update lumina-node version
npm version $node_wasm_version
if ! npm version $node_wasm_version >/dev/null; then
echo "Version up to date"
exit
fi
# Update the version of lumina-node-wasm dependency
npm pkg set "dependencies[lumina-node-wasm]=$node_wasm_version"
# push a commit to release-plz's pr
# prepare graphql query
Expand All @@ -81,11 +87,18 @@ jobs:
{ commit { commitUrl } }
}"}'
# create new commit with changes
curl https://api.github.com/graphql \
result=$(curl -sS https://api.github.com/graphql \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
--data "$(echo "$query" | tr -d '\n')"
--data "$(echo "$query" | tr -d '\n')")
if echo "$result" | jq -e '.errors | length != 0' >/dev/null; then
echo "Commit failed: $(echo "$result" | jq '.errors')" >&2
exit 1
else
echo "Version updated: ${node_wasm_version}"
fi
- name: Release to npm
env:
Expand Down

0 comments on commit fa700aa

Please sign in to comment.