-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (45 loc) · 1.28 KB
/
build-and-publish.yml
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
name: Build and Publish
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
# write is required to write to releases
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: '20.x'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Create Package
run: |
if npm version --no-git-tag-version from-git > /dev/null 2>&1; then
echo "Using auto version based on git tag"
else
echo "Using version 0.0.0-dev"
npm version --no-git-tag-version 0.0.0-dev
fi
mkdir out
npm pack --pack-destination out
- name: Upload build artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: package
path: out/
- name: Attach build artifact to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8
with:
files: out/*.tgz