diff --git a/.github/workflows/update-cli-version.yml b/.github/workflows/update-cli-version.yml index 6bc7143..772c0ff 100644 --- a/.github/workflows/update-cli-version.yml +++ b/.github/workflows/update-cli-version.yml @@ -8,6 +8,8 @@ jobs: update-cli-version: if: "${{contains(github.event.head_commit.message, 'chore(main): release')}}" runs-on: ubuntu-latest + outputs: + new_version: ${{ steps.create_branch.outputs.new_version }} steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -17,6 +19,7 @@ jobs: ROOT_VERSION=$(jq -r '.version' package.json) NEW_BRANCH="npm-pull-request-of-v${ROOT_VERSION}" echo "NEW_BRANCH=$NEW_BRANCH" >> $GITHUB_ENV + echo "::set-output name=new_version::$ROOT_VERSION" git checkout -b $NEW_BRANCH - name: Update CLI package.json @@ -25,18 +28,18 @@ jobs: jq ".version = \"$ROOT_VERSION\"" packages/cli/package.json > temp.json && mv temp.json packages/cli/package.json git config --local user.email "action@github.com" git config --local user.name "github-actions[bot]" - git add packages/cli/package.json + git add . git commit -m "chore(cli): sync package version to cli" git push --set-upstream origin ${{ env.NEW_BRANCH }} - + - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "chore(cli): release npm version of ${{steps.set_version.outputs.version}}" - title: "Publish npm v${{ steps.set_version.outputs.version }}" - body: "Update npm package version to ${{ steps.set_version.outputs.version }}" - branch: "npm-pull-request-of-v${{ steps.set_version.outputs.version }}" + commit-message: "chore(cli): release npm version of ${{ steps.create_branch.outputs.new_version }}" + title: "Publish npm v${{ steps.create_branch.outputs.new_version }}" + body: "Update npm package version to ${{ steps.create_branch.outputs.new_version }}" + branch: "npm-pull-request-of-v${{ steps.create_branch.outputs.new_version }}" base: main labels: release id: cpr