-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (48 loc) · 1.45 KB
/
publish.yml
File metadata and controls
48 lines (48 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Publish
permissions:
contents: write
id-token: write
on:
push:
branches:
- master
- master-*
jobs:
publish:
name: Publish package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Determine Version Type
id: version-type
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const ref = process.env.GITHUB_REF_NAME;
return ref == "master" ? "beta" : ref == "master-2" ? "alpha" : "latest";
- name: Bump version
run: |
if [ "${{ steps.version-type.outputs.result }}" = "latest" ]; then
npm version minor;
else
npm version prerelease --preid=${{ steps.version-type.outputs.result }};
fi
- name: Push bumped version
run: git push --follow-tags
- name: Build package
run: npm run build
- name: Publish package
run: npm publish --access public --provenance --tag ${{ steps.version-type.outputs.result }}