Skip to content

Commit

Permalink
chore: workflow for pub multi next version (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
homura committed Aug 11, 2022
1 parent bc3b8f1 commit 635ca26
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
# When Release Pull Request is merged
push:
branches:
- develop
- 'v[0-9]+.[0-9]+.[0-9]+*'
- 'next/v[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: write # for checkout and tag
Expand Down Expand Up @@ -36,6 +37,16 @@ jobs:
run: |
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Prerelease Check
id: prerelease_check
run: |
if [[ ${REF_NAME} =~ ^next\/v[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
echo ::set-output name=prerelease::true
else
echo ::set-output name=prerelease::false
fi
env:
REF_NAME: ${{ github.ref_name }}
- name: Tag Check
id: tag_check
run: |
Expand All @@ -60,24 +71,27 @@ jobs:
git_tag_prefix: "v"
- name: Create Release
id: create_release
if: steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
if: steps.tag_check.outputs.exists_tag == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BODY: ${{ github.event.commits[0].message }}
with:
tag_name: v${{ env.CURRENT_VERSION }}
# Copy Pull Request's tile and body to Release Note
release_name: ${{ github.event.pull_request.title }}
release_name: ${{ env.CURRENT_VERSION }}
body: |
${{ github.event.pull_request.body }}
${{ env.RELEASE_BODY }}
draft: false
prerelease: false
prerelease: steps.tag_check.prerelease_check.prerelease == 'true'

- name: Publish
if: steps.tag_check.outputs.exists_tag == 'false'
run: |
yarn run build
yarn run build-release
yarn lerna publish from-package --yes
yarn lerna publish from-package --yes --dist-tag $([ $PRERELEASE == 'true' ] && echo 'next' || echo 'latest')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PRERELEASE: ${{ steps.prerelease_check.outputs.prerelease }}
14 changes: 7 additions & 7 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Publish

0. [Local] Checkout release branch: `git checkout release/<uniq>`
1. [Local] Run `yarn run versionup`
1. [Local] Checkout release branch: `git checkout v<version>` or `git checkout next/v<version>`
2. [Local] Run `yarn run versionup` or `yarn run versionup:prerelease`
- Update CHANGELOG.md and `package.json`'s `version`, and `lerna.json`'s `version`
- It does not git tag
2. [Local] Submit to Release Pull Request
3. [GitHub] Review Release Pull Request
4. [GitHub] Write Release Note into the Release Pull Request's body
5. [GitHub] Merge Release Pull Request
6. [CI] Create git tag && Create GitHub Release && publish to npm(GitHub Package Registry)
3. [Local] Submit to Release Pull Request
4. [GitHub] Review Release Pull Request
5. [GitHub] Write Release Note into the Release Pull Request's body
6. [GitHub] Merge Release Pull Request
7. [CI] Create git tag && Create GitHub Release && publish to npm(GitHub Package Registry)
- :memo: The GitHub Release's body is copied from Release Pull Request's body
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"versionup:patch": "lerna version patch --conventional-commits --no-git-tag-version",
"versionup:minor": "lerna version minor --conventional-commits --no-git-tag-version",
"versionup:major": "lerna version major --conventional-commits --no-git-tag-version",
"versionup:prerelease": "lerna version --conventional-commits --no-git-tag-version --conventional-prerelease --force-publish",
"postversionup": "npm run commit-version",
"postversionup:patch": "npm run commit-version",
"postversionup:minor": "npm run commit-version",
Expand Down

1 comment on commit 635ca26

@vercel
Copy link

@vercel vercel bot commented on 635ca26 Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lumos-website – ./

lumos-website-git-develop-cryptape.vercel.app
lumos-website.vercel.app
lumos-website-cryptape.vercel.app

Please sign in to comment.