Skip to content

Commit

Permalink
Merge pull request #41 from VisActor/chore/release_pr
Browse files Browse the repository at this point in the history
chore: release workflow
  • Loading branch information
fangsmile committed Jun 16, 2023
2 parents 0cc8a0b + 87aa8e6 commit 20b1ccf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Thank you!
- [ ] Site / documentation update
- [ ] Demo update
- [ ] Workflow
- [ ] Chore
- [ ] Release
- [ ] Other (about what?)

### 🔗 Related issue link
Expand Down
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pr_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- [ ] 网站/文档更新
- [ ] demo 更新
- [ ] Workflow
- [ ] 配置修改
- [ ] 发布
- [ ] 其他 (具体是什么,请补充?)

### 🔗 相关 issue 连接
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,34 @@ jobs:

- name: Parse semver version from branch name
id: semver_parser
uses: release-kit/semver@v2
uses: xile611/read-package-version-action@v2.1
with:
string: ${{ github.ref_name }}
pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default
path: packages/vtable
semver_string: ${{ github.ref_name }}
semver_pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default

- name: Apply prereleaseName
run: node common/scripts/install-run-rush.js publish --apply --prerelease-name ${{ steps.semver_parser.outputs.prerelease }} --partial-prerelease
run: node common/scripts/install-run-rush.js publish --apply --prerelease-name ${{ steps.semver_parser.outputs.pre_release_name }} --partial-prerelease

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.prerelease }}
run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.pre_release_type }}

- name: Update shrinkwrap
run: node common/scripts/install-run-rush.js update

- name: Get package version
- name: Get npm version
id: package-version
uses: culshaw/read-package-node-version-actions@v1
uses: xile611/read-package-version-[email protected]
with:
path: './packages/vtable' # 各项目需要修改一下
path: packages/vtable

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'build: prelease version ${{ steps.package-version.outputs.version }}'
message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}'
branch: ${{ github.ref_name }}
author_name: ${{ github.actor }}
30 changes: 17 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
run: node common/scripts/install-run-rush.js install --bypass-policy

- name: Build packages
run: node common/scripts/install-run-rush.js build --only tag:package

- name: Update version
run: node common/scripts/install-run-rush.js version --bump

- name: Publish to npm
Expand All @@ -46,35 +49,36 @@ jobs:
- name: Update shrinkwrap
run: node common/scripts/install-run-rush.js update

- name: Get package version
- name: Get npm version
id: package-version
uses: culshaw/read-package-node-version-actions@v1
uses: xile611/read-package-version-[email protected]
with:
path: './packages/vtable' # 各项目修改一下
path: packages/vtable

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'build: prelease version ${{ steps.package-version.outputs.version }}'
message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}'
branch: ${{ github.ref_name }}

- name: Create Release for Tag
id: release_tag
# See more about this action: https://github.com/actions/create-release
uses: actions/create-release@v1
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package-version.outputs.version }}
release_name: Release v${{ steps.package-version.outputs.version }}
prerelease: false #
tag: v${{ steps.package-version.outputs.current_version }}
commit: main
prerelease: false
draft: true #

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
uses: dustinirving/create-[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: '[Auto release] release ${{ steps.package-version.outputs.current_version }}'
base: main
branch: ${{ github.ref_name }}
title: '[Auto release] release ${{ steps.package-version.outputs.version }}'
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
head: ${{ github.ref_name }}
labels: release # default labels, the action will throw error if not specified
reviewers: fangsmile,Rui-Sun # default reviewers, the action will throw error if not specified
2 changes: 1 addition & 1 deletion common/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [[ $STAGE_FILES != "" ]] ; then
if [[ $changedFiles != "" ]] ; then

echo "
[Notice]: please check, do you need to run ${RED}${BIG_FONT}rush change${RESET} to generate changelog,
[Notice]: please check, do you need to run ${RED}${BIG_FONT}rush change-all${RESET} to generate changelog,
you has modified some src files, include:
${changedFiles}
"
Expand Down

0 comments on commit 20b1ccf

Please sign in to comment.