chore: deploy workflow #2
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: Deploy | |
on: | |
# release: | |
# types: [published] | |
push: # push 到主分支自动 发布 | |
branches: ['master'] | |
paths-ignore: # 忽略一些不必要的文件 | |
- '.gitignore' | |
- 'README.md' | |
- '.vscode/**' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: | |
name: 'production' | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16.14' | |
- name: Cache install | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: | | |
node_modules | |
.yarn/cache | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --mode=skip-build | |
- name: Authenticate with Registry | |
run: | | |
echo "registry=http://registry.npmjs.org/" >> .npmrc | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | |
npm whoami | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish | |
run: lerna publish --yes |