fix: add missing period to README description for clarity #2
This file contains hidden or 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 Release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
release: | |
types: [created] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
# 如果这是一个发布版本(tag),则创建一个 release | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/* | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# 发布到 npm | |
- name: Publish to NPM | |
if: startsWith(github.ref, 'refs/tags/') | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |