Update lerna.json #239
Workflow file for this run
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
name: Build and publish | |
on: | |
push: | |
tags: | |
- 'v**' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Check valid tag format | |
if: steps.version.outputs.is_valid == 'false' | |
run: exit 1 | |
- name: Get branch names | |
id: branch-name | |
uses: tj-actions/[email protected] | |
with: | |
strip_tag_prefix: v | |
- name: Get the current tag | |
if: steps.branch-name.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo "tag: ${{ steps.branch-name.outputs.tag }}" | |
echo "current_branch: ${{ steps.branch-name.outputs.current_branch }}" | |
echo "ref_branch: ${{ steps.branch-name.outputs.ref_branch }}" | |
- name: Check valid branch | |
if: ${{ !startsWith(steps.branch-name.outputs.tag, '6.') }} | |
run: exit 1 | |
# checkout branch 1.0 | |
- name: Checkout branch 1.0 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.0') }} | |
with: | |
ref: '1.0' | |
# checkout branch 1.1 | |
- name: Checkout branch 1.1 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.1') }} | |
with: | |
ref: '1.1' | |
# checkout branch 1.2 | |
- name: Checkout branch 1.2 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.2') }} | |
with: | |
ref: '1.2' | |
# checkout branch 1.3 | |
- name: Checkout branch 1.3 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.3') }} | |
with: | |
ref: '1.3' | |
# checkout branch 3.6 | |
- name: Checkout branch 3.6 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '3.6') }} | |
with: | |
ref: '3.6' | |
- name: Checkout branch 6.3 | |
uses: actions/checkout@v2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '6.3') }} | |
with: | |
ref: '6.3' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "yarn" | |
- name: Lerna version | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn --frozen-lockfile | |
yarn lerna version ${{ steps.branch-name.outputs.tag }} --force-publish --exact --yes | |
- name: Yarn Build | |
env: | |
CI: false | |
run: | | |
yarn build && yarn build-app | |
- name: Lerna publish beta | |
if: ${{ steps.version.outputs.is_stable != 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --yes --registry https://registry.npmjs.org --dist-tag beta | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 1.0 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.0') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --yes --registry https://registry.npmjs.org --dist-tag 1.0 | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 1.1 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.1') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --registry https://registry.npmjs.org --yes --dist-tag 1.1 | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 1.2 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.2') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --registry https://registry.npmjs.org --yes --dist-tag 1.2 | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 1.3 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '1.3') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --registry https://registry.npmjs.org --yes --dist-tag 1.3 | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 3.6 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '3.6') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --registry https://registry.npmjs.org --yes | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Lerna publish 6.3 | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '6.3') && steps.version.outputs.is_stable == 'true' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
yarn lerna publish from-package --registry https://registry.npmjs.org --yes --dist-tag 6.3 | |
env: | |
CI: false | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Merge 3.6 -> master | |
if: ${{ startsWith(steps.branch-name.outputs.tag, '3.6') }} | |
uses: devmasx/merge-branch@master | |
with: | |
type: now | |
from_branch: 3.6 | |
target_branch: master | |
github_token: ${{ github.token }} | |
- name: Sleep 60s, wait for npm cache | |
uses: juliangruber/sleep-action@v1 | |
with: | |
time: 60s | |
- name: Sync NpmMirror | |
env: | |
CI: false | |
run: | | |
yarn cnpm-sync |