-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update husky and add release workflow (#6041)
* chore: update husky * chore: update github workflows * chore: update scripts * chore: fix workflow
- Loading branch information
Showing
6 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 创建发布分支和 PR / Create release branch and PR | ||
name: Create release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create_release_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create release branch | ||
run: | | ||
git checkout -b release | ||
git add . | ||
git commit -m "Update for automated release PR" || true | ||
git push --set-upstream origin release | ||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
base: v5 | ||
title: '[Bot] Automated PR from release to v5' | ||
body: 'This PR was created automatically by GitHub Actions.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 合并 release 分支到 v5 分支时自动发布到 npm | ||
name: Auto Release | ||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- v5 | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.head.ref == 'release' && github.event.pull_request.merged == true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install pnpm and dependencies | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: pnpm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} & pnpm release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 自动更新版本号 / Auto Update Version | ||
name: Auto Update Version | ||
on: | ||
push: | ||
branches: | ||
- release | ||
|
||
jobs: | ||
version: | ||
name: Update Package Version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install pnpm and dependencies | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Update Version | ||
run: | | ||
cd ./packages/g6 | ||
npm run version | ||
- name: Create Release Pull Request | ||
uses: changesets/action@v1 | ||
with: | ||
commit: 'chore(release): update version' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
protected_branches="master v5" | ||
current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
for branch in $protected_branches; do | ||
if [ "$current_branch" == "$branch" ]; then | ||
echo "\033[31mDirect commit to '$branch' branch are not allowed!\033[0m" | ||
exit 1 | ||
fi | ||
done | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters