Skip to content

Commit

Permalink
chore(main): release 测试npm发布逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
danni-cool committed Jan 12, 2024
1 parent 9a584f5 commit f648677
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/update-cli-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 "[email protected]"
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
Expand Down

0 comments on commit f648677

Please sign in to comment.