Skip to content

Commit 635ca26

Browse files
committed
chore: workflow for pub multi next version (#380)
1 parent bc3b8f1 commit 635ca26

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ on:
33
# When Release Pull Request is merged
44
push:
55
branches:
6-
- develop
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
- 'next/v[0-9]+.[0-9]+.[0-9]+*'
78

89
permissions:
910
contents: write # for checkout and tag
@@ -36,6 +37,16 @@ jobs:
3637
run: |
3738
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
3839
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
40+
- name: Prerelease Check
41+
id: prerelease_check
42+
run: |
43+
if [[ ${REF_NAME} =~ ^next\/v[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
44+
echo ::set-output name=prerelease::true
45+
else
46+
echo ::set-output name=prerelease::false
47+
fi
48+
env:
49+
REF_NAME: ${{ github.ref_name }}
3950
- name: Tag Check
4051
id: tag_check
4152
run: |
@@ -60,24 +71,27 @@ jobs:
6071
git_tag_prefix: "v"
6172
- name: Create Release
6273
id: create_release
63-
if: steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
74+
if: steps.tag_check.outputs.exists_tag == 'false'
6475
uses: actions/create-release@v1
6576
env:
6677
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
RELEASE_BODY: ${{ github.event.commits[0].message }}
6779
with:
6880
tag_name: v${{ env.CURRENT_VERSION }}
6981
# Copy Pull Request's tile and body to Release Note
70-
release_name: ${{ github.event.pull_request.title }}
82+
release_name: ${{ env.CURRENT_VERSION }}
7183
body: |
72-
${{ github.event.pull_request.body }}
84+
${{ env.RELEASE_BODY }}
7385
draft: false
74-
prerelease: false
86+
prerelease: steps.tag_check.prerelease_check.prerelease == 'true'
87+
7588
- name: Publish
7689
if: steps.tag_check.outputs.exists_tag == 'false'
7790
run: |
7891
yarn run build
7992
yarn run build-release
80-
yarn lerna publish from-package --yes
93+
yarn lerna publish from-package --yes --dist-tag $([ $PRERELEASE == 'true' ] && echo 'next' || echo 'latest')
8194
env:
8295
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8396
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
97+
PRERELEASE: ${{ steps.prerelease_check.outputs.prerelease }}

DEVELOPMENT.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Publish
44

5-
0. [Local] Checkout release branch: `git checkout release/<uniq>`
6-
1. [Local] Run `yarn run versionup`
5+
1. [Local] Checkout release branch: `git checkout v<version>` or `git checkout next/v<version>`
6+
2. [Local] Run `yarn run versionup` or `yarn run versionup:prerelease`
77
- Update CHANGELOG.md and `package.json`'s `version`, and `lerna.json`'s `version`
88
- It does not git tag
9-
2. [Local] Submit to Release Pull Request
10-
3. [GitHub] Review Release Pull Request
11-
4. [GitHub] Write Release Note into the Release Pull Request's body
12-
5. [GitHub] Merge Release Pull Request
13-
6. [CI] Create git tag && Create GitHub Release && publish to npm(GitHub Package Registry)
9+
3. [Local] Submit to Release Pull Request
10+
4. [GitHub] Review Release Pull Request
11+
5. [GitHub] Write Release Note into the Release Pull Request's body
12+
6. [GitHub] Merge Release Pull Request
13+
7. [CI] Create git tag && Create GitHub Release && publish to npm(GitHub Package Registry)
1414
- :memo: The GitHub Release's body is copied from Release Pull Request's body

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"versionup:patch": "lerna version patch --conventional-commits --no-git-tag-version",
6262
"versionup:minor": "lerna version minor --conventional-commits --no-git-tag-version",
6363
"versionup:major": "lerna version major --conventional-commits --no-git-tag-version",
64+
"versionup:prerelease": "lerna version --conventional-commits --no-git-tag-version --conventional-prerelease --force-publish",
6465
"postversionup": "npm run commit-version",
6566
"postversionup:patch": "npm run commit-version",
6667
"postversionup:minor": "npm run commit-version",

0 commit comments

Comments
 (0)