Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix lumina-node npm version bump on ci #386

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading