-
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.21 KB
/
build.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "Build TapToQR Artifact"
on:
workflow_dispatch:
inputs:
VERSION:
description: "The version of the addon to build"
type: string
required: false
workflow_call:
inputs:
VERSION:
description: "The version of the addon to build"
type: string
required: false
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && 'pull_request' || 'push' }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
build-artifact:
name: "Build TapToQR Artifact"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Determine VERSION
id: determine-version
run: |
if [ -z "${{ inputs.VERSION }}" ]; then
echo "Using repository version"
echo ${{ vars.VERSION }}
echo "VERSION=${{ vars.VERSION }}" >> $GITHUB_OUTPUT
else
echo "Using input version"
echo ${{ inputs.VERSION }}
echo "VERSION=${{ inputs.VERSION }}" >> $GITHUB_OUTPUT
fi
- name: Update Version
run: |
jq --arg version "${{steps.determine-version.outputs.VERSION}}" '.version = $version' package.json > temp.json && mv temp.json package.json
cd addon
jq --arg version "${{steps.determine-version.outputs.VERSION}}" '.version = $version' manifest.json > temp.json && mv temp.json manifest.json
- name: Install dependencies
run: npm install
- name: Lint code
run: npm run lint
- name: Webpack project
run: npm run webpack-prod
- name: Create Artifact
run: |
cd addon
zip -r ../TapToQR-${{steps.determine-version.outputs.VERSION}}.zip ./*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: 'TapToQR-${{steps.determine-version.outputs.VERSION}}.zip'
name: 'TapToQR-addon'