-
Notifications
You must be signed in to change notification settings - Fork 139
58 lines (48 loc) · 1.63 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
name: Build
env:
PLUGIN_NAME: obsidian-to-anki-plugin
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
install-exact: [1, 0]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# obsidian package often fails integrity checks since its a tarball, hence will get the get the tarball -> npm will cache it -> npm ci will test integrity of that cache vs package-lock.json
# https://github.com/ShootingKing-AM/Obsidian_to_Anki/pull/122
# Installing exact tree would be used in CI/CD to exactly reproduce tests
- name: Node install exact tree
if: matrix.install-exact == 1
run: |
npm install obsidian
npm ci
# Install latest tree would be usually done by devs/who locally build the plugin
- name: Node install latest tree
if: matrix.install-exact == 0
run: |
npm update
npm install
- run: npm run build --if-present
# - run: npm test
- name: Package
run: |
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css README.md ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}
path: |
${{ env.PLUGIN_NAME }}.zip