-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5160748
commit f2a2a1f
Showing
1 changed file
with
89 additions
and
0 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,89 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: | ||
- ci-publish | ||
# pull_request: | ||
# branches: | ||
# - master | ||
# types: [closed] | ||
|
||
env: | ||
CI: true | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
# - name: Pull Request Merged | ||
# if: github.event.pull_request.merged == false | ||
# run: | | ||
# echo 'The pull request has not been merged' | ||
# exit 1 | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
- name: Setup .npmrc | ||
shell: bash | ||
run: | | ||
npm set registry=https://registry.npmjs.org/ | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > ~/.npmrc | ||
- name: Ensure access | ||
shell: bash | ||
run: npm whoami | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
|
||
- name: Config git user | ||
shell: bash | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
- name: Install | ||
run: yarn | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Get Prev Version | ||
shell: bash -ex {0} | ||
run: | | ||
PREV_VERSION=$(node -p 'require("./lerna.json").version') | ||
echo "::set-env name=PREV_VERSION::${PREV_VERSION}" | ||
- name: Bump versions and publish packages | ||
run: | | ||
npx lerna version --yes --create-release github --message 'chore(release): publish' | ||
npx lerna publish from-package --yes | ||
- name: Get Current Version | ||
shell: bash -ex {0} | ||
run: | | ||
CURRENT_VERSION=$(node -p 'require("./lerna.json").version') | ||
echo "::set-env name=CURRENT_VERSION::${CURRENT_VERSION}" | ||
# - name: Create comment | ||
# uses: actions/github-script@v7 | ||
# if: env.PREV_VERSION != env.CURRENT_VERSION | ||
# with: | ||
# github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# script: | | ||
# github.issues.createComment({ | ||
# issue_number: context.issue.number, | ||
# owner: context.repo.owner, | ||
# repo: context.repo.repo, | ||
# body: 'NPM package v${{ env.CURRENT_VERSION }} has been published 🎉' | ||
# }) |