Skip to content

Commit 0ebebca

Browse files
committed
CI: build assets
1 parent 6200e96 commit 0ebebca

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/assets.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Assets"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: ["master"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: '22.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
- run: npm install
19+
- run: npm run build
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: dist-files
23+
path: dist
24+
25+
publish:
26+
runs-on: ubuntu-latest
27+
needs: [build]
28+
permissions:
29+
contents: read
30+
id-token: write
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/download-artifact@v4
34+
with:
35+
name: dist-files
36+
path: dist/
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: '22.x'
40+
registry-url: 'https://registry.npmjs.org'
41+
- name: Generate version
42+
id: version
43+
run: |
44+
COMMIT_HASH=$(git rev-parse --short HEAD)
45+
DATE=$(date +'%Y%m%d')
46+
VERSION="0.0.0-$DATE-$COMMIT_HASH"
47+
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
- run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version
49+
- run: npm publish --provenance --tag master
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)