From 82dd4eb49349b72753c86027d589333f363ad6c5 Mon Sep 17 00:00:00 2001 From: Boshen Date: Fri, 6 Sep 2024 10:19:27 +0800 Subject: [PATCH] ci: update package.json in release-plz.yml --- .github/workflows/release-plz.yml | 25 +++++++++++++++++++++++-- justfile | 5 ----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index f757d84a..d12e1bcb 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -27,9 +27,30 @@ jobs: cache-key: warm - name: Run release-plz + id: release-plz uses: MarcoIeni/release-plz-action@v0.5 - with: - command: release env: GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + - name: Bump package.json + if: ${{ steps.release-plz.outputs.prs_created }} + env: + RELEASES: ${{ steps.release-plz.outputs.releases }} + PR: ${{ steps.release-plz.outputs.pr } + run: | + set -e + + pr_number=${{ fromJSON(steps.release-plz.outputs.pr).number }} + if [[ -n "$pr_number" ]]; then + version=$(echo "$RELEASES" | jq -r '.[0].version') + echo "version: $version" + + jq --arg version "${version}" '.version = ($version)' npm/package.json > tmp + mv tmp npm/package.json + + gh pr checkout $pr_number + git add . + git commit -m "Update package.json" + git push + fi diff --git a/justfile b/justfile index f7f3b98d..9e65e154 100644 --- a/justfile +++ b/justfile @@ -68,8 +68,3 @@ benchmark: # Run cargo-fuzz fuzz: cd fuzz && cargo +nightly fuzz run --sanitizer none resolver -- -only_ascii=1 -max_total_time=900 - -release: - cargo binstall -y release-plz cargo-semver-checks - release-plz update - just check