Skip to content

Commit a57c1e7

Browse files
committed
add github action
1 parent d6f20bb commit a57c1e7

3 files changed

Lines changed: 13 additions & 74 deletions

File tree

.github/workflows/pages.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ on:
77

88
permissions:
99
contents: write
10+
id-token: write
1011

1112
jobs:
1213
release:
1314
runs-on: ubuntu-latest
15+
environment: npm
1416

1517
steps:
1618
- uses: actions/checkout@v4
@@ -19,18 +21,14 @@ jobs:
1921
uses: actions/setup-node@v4
2022
with:
2123
node-version: 20
22-
cache: npm
2324
registry-url: https://registry.npmjs.org
2425

2526
- name: Install dependencies
26-
run: npm ci
27+
run: npm install
2728

2829
- name: Build
2930
run: npm run build
3031

31-
- name: Run tests
32-
run: npm test
33-
3432
- name: Create GitHub Release
3533
uses: softprops/action-gh-release@v2
3634
with:
@@ -43,8 +41,16 @@ jobs:
4341
dist/jos.full.js
4442
dist/jos.full.min.js
4543
generate_release_notes: true
44+
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') || contains(github.ref, 'rc') }}
45+
46+
- name: Publish to npm (beta)
47+
if: contains(github.ref, 'beta') || contains(github.ref, 'alpha') || contains(github.ref, 'rc')
48+
run: npm publish --provenance --access public --tag beta
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4651

47-
- name: Publish to npm
48-
run: npm publish
52+
- name: Publish to npm (latest)
53+
if: "!contains(github.ref, 'beta') && !contains(github.ref, 'alpha') && !contains(github.ref, 'rc')"
54+
run: npm publish --provenance --access public
4955
env:
5056
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)