feat: CI/CD #2
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: Release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org # 发布时要用到 | |
- name: Publish to NPM | |
run: | | |
yarn | |
npm run test | |
npm version ${{ github.ref_name }} | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Config Git | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: Publish Pages | |
run: | | |
cp -r .git test/ && cd test | |
git checkout --orphan gh-pages | |
git add . | |
git commit -m "publish pages" | |
git push --force --progress "origin" gh-pages |