Skip to content

ci: Ignore the yarn.lock file in the release step #48

ci: Ignore the yarn.lock file in the release step

ci: Ignore the yarn.lock file in the release step #48

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
- dev
- 'feat*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
environment: Production
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: dependencies cache
uses: actions/cache@v3
with:
path: |
~/.npm
~/.cache
~/node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Debug NPM_TOKEN
run: |
echo "NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}"
echo "NPM_TOKEN_EMPTY: ${{ secrets.NPM_TOKEN_EMPTY }}"
- name: Yarn install
run: yarn install
- name: Run Packages Tests
run: |
ls -la
# yarn run test skip
- name: Build Packages
run: |
npx lerna exec --scope='@pagenote/*' --no-private --include-dependencies yarn build
- name: Set Git Identity
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
#https://github.com/lerna/lerna/tree/main/libs/commands/version#semver-bump
# 开发阶段的版本号 预发布
- name: Lerna feature Version
if: startsWith(github.ref, 'refs/heads/feat')
run: |
npx lerna version prepatch --preid next --amend --conventional-commits --conventional-prerelease --yes
# 修订版本号
- name: Lerna dev Version
if: github.ref =='refs/heads/dev'
run: |
npx lerna version --no-private patch --yes
# 正式发布
- name: Lerna main Version
if: github.ref == 'refs/heads/main'
run: |
npx lerna version --no-private minor --yes
- name: Create .npmrc
run: echo 'registry=https://registry.npmjs.org' > ~/.npmrc && echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> ~/.npmrc
# https://github.com/lerna/lerna/tree/main/libs/commands/publish#readme
- name: Publish to NPM
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
run: |
npx lerna publish from-git --yes
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}