1
- name : MVP - make, version & publish
1
+ name : NodeJS Build
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - main
7
- workflow_dispatch : # This line adds manual triggering from the GitHub UI
8
-
9
- concurrency : ${{ github.workflow }}-${{ github.ref }}
5
+ branches : [ "main" ]
6
+ pull_request :
7
+ branches : [ "main" ]
10
8
11
9
jobs :
12
- make_version_publish :
13
- name : Make, Version & Publish
10
+ build :
14
11
runs-on : ubuntu-latest
15
- steps :
16
- - name : Checkout Repo
17
- uses : actions/checkout@v4
18
-
19
- - name : Setup Node 20.x
20
- uses : actions/setup-node@v4
21
- with :
22
- node-version : 20.x
23
-
24
- - name : Install bun & Deps
25
- run : |
26
- npm install bun -g
27
- bun install
28
-
29
- - name : ' Build - all browsers'
30
- id : buildProject
31
- run : MODE=chrome vite build && MODE=firefox vite build
32
12
33
- - name : ' [ V E R S I O N ] : Create or Update Release Pull Request - Version Changes'
34
- id : changesets
35
- uses : changesets/action@v1
36
- with :
37
- version : bun run version
38
- env :
39
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13
+ strategy :
14
+ matrix :
15
+ node-version : [20.x]
40
16
41
- - name : ' Get current version info from package.json'
42
- if : steps.changesets.outputs.hasChangesets == 'false'
43
- id : package
44
- run : |
45
- echo "::set-output name=PACKAGE_NAME::$(jq -r .name package.json)"
46
- echo "::set-output name=PACKAGE_VERSION::$(jq -r .version package.json)"
47
- working-directory : ${{ github.workspace }}
48
-
49
- - name : ' Check if a git release already exists for current version'
50
- if : steps.changesets.outputs.hasChangesets == 'false'
51
- id : checkRelease
52
- run : |
53
- TAG_NAME=${{ steps.package.outputs.PACKAGE_NAME }}@${{ steps.package.outputs.PACKAGE_VERSION }}
54
- if gh release view $TAG_NAME &>/dev/null; then
55
- echo "Release $TAG_NAME already exists."
56
- echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
57
- else
58
- echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
59
- fi
60
-
61
- - name : ' Create Release Archive(s) - zip 🫰 it 🫰 up 🫰 !'
62
- id : zip
63
- if : steps.changesets.outputs.hasChangesets == 'false'
64
- run : bun run zip
65
-
66
- - name : ' Create a git release w/ notes & release archive(s)'
67
- id : gitRelease
68
- if : steps.changesets.outputs.hasChangesets == 'false' && env.RELEASE_EXISTS != 'true'
69
- run : bun run release
70
- env :
71
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72
- PACKAGE_NAME : ${{ steps.package.outputs.PACKAGE_NAME }}
73
- PACKAGE_VERSION : ${{ steps.package.outputs.PACKAGE_VERSION }}
17
+ steps :
18
+ - uses : actions/checkout@v4
19
+
20
+ - name : Use Node.js ${{ matrix.node-version }}
21
+ uses : actions/setup-node@v4
22
+ with :
23
+ node-version : ${{ matrix.node-version }}
24
+
25
+ - name : Build
26
+ run : |
27
+ npm install
28
+ npm run build
29
+
30
+ - name : Zip dist folder
31
+ run : |
32
+ zip -r dist.zip dist
33
+
34
+ - name : Upload artifact
35
+ uses : actions/upload-artifact@v4
36
+ with :
37
+ name : dist-zip
38
+ path : dist.zip
0 commit comments