Skip to content

Commit

Permalink
feat: add publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aelf-lxy committed Aug 1, 2024
1 parent 122c5ef commit ef8d7a5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
push:
branches:
- release/refactor-3.0.0
- feature/badge-new
pull_request:
branches:
- release/refactor-3.0.0

jobs:
test:
coverage:
runs-on: ubuntu-latest

strategy:
Expand All @@ -23,7 +24,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'

- name: Install pnpm
run: npm install -g pnpm
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: publish to npm
env:
CI: true
on:
push:
branches:
- release/refactor-3.0.0
- feature/badge-new
tags:
- '!*'
pull_request:
branches:
- release/refactor-3.0.0
jobs:
release:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
pnpm release || (echo "pnpm publish failed" && exit 1)
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ef8d7a5

Please sign in to comment.