-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.23 KB
/
build.yml
File metadata and controls
76 lines (65 loc) · 2.23 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
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
name: Build plugin
permissions:
contents: write
on:
release:
types: [published]
workflow_dispatch: {}
jobs:
build:
name: Build JS bundles
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: |
npm ci || npm install
- name: Create dist directory
run: mkdir -p dist
- name: Build unminified bundle with esbuild
run: |
npx esbuild src/index.ts \
--bundle \
--format=iife \
--global-name=YasguiGraphPlugin \
--define:process.env.NODE_ENV=\"production\" \
--loader:.png=dataurl \
--loader:.svg=dataurl \
--loader:.jpg=dataurl \
--loader:.gif=dataurl \
--outfile=dist/yasgui-graph-plugin.js
- name: Build minified bundle with esbuild
run: |
npx esbuild src/index.ts \
--bundle \
--minify \
--format=iife \
--global-name=YasguiGraphPlugin \
--define:process.env.NODE_ENV=\"production\" \
--loader:.png=dataurl \
--loader:.svg=dataurl \
--loader:.jpg=dataurl \
--loader:.gif=dataurl \
--outfile=dist/yasgui-graph-plugin.min.js
- name: Create minified CSS (if available)
run: |
# prefer a root style.css, then demo/style.css, otherwise create a minimal placeholder
if [ -f style.css ]; then
cat style.css > dist/yasgui-graph-plugin.min.css
elif [ -f demo/style.css ]; then
cat demo/style.css > dist/yasgui-graph-plugin.min.css
else
echo '/* yasgui-graph-plugin: no CSS provided */' > dist/yasgui-graph-plugin.min.css
fi
- name: Upload minified JS to GitHub Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: |
dist/yasgui-graph-plugin.min.js
dist/yasgui-graph-plugin.min.css