Skip to content

Commit b0f4e3a

Browse files
committed
添加发布 CI
1 parent 6235f3f commit b0f4e3a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish package
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
publish-npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: '18.x'
15+
registry-url: https://registry.npmjs.org/
16+
- run: yarn install
17+
- run: yarn build
18+
- run: yarn publish
19+
env:
20+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
21+
22+
publish-github:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-node@v3
30+
with:
31+
node-version: '18.x'
32+
registry-url: 'https://npm.pkg.github.com'
33+
scope: '@devlive-community'
34+
- run: yarn install
35+
- run: yarn build
36+
37+
- name: Update package name
38+
run: |
39+
sed -i 's/"name": "pageforge"/"name": "@devlive-community\/pageforge"/' package.json
40+
41+
- run: |
42+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_PACKAGE_TOKEN }}" >> .npmrc
43+
echo "@devlive-community:registry=https://npm.pkg.github.com" >> .npmrc
44+
yarn publish --non-interactive --access public
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_TOKEN }}

0 commit comments

Comments
 (0)