-
Notifications
You must be signed in to change notification settings - Fork 5
101 lines (95 loc) · 3.17 KB
/
build-library.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# It will also deploy the build to two different repos with https://github.com/peaceiris/actions-gh-pages
name: Build ImJoy Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [13.14.0]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run check-format
- run: npm run build
- run: npm run test
- name: download elFinder
run: |
wget https://github.com/imjoy-team/elFinder/archive/refs/heads/gh-pages.zip
unzip gh-pages.zip
rm gh-pages.zip
rm -rf dist/elFinder
mv elFinder-gh-pages/ dist/elFinder
cp dist/elFinder/service-worker.js dist # make sure we have service worker for all domains
- name: Save build output
uses: actions/upload-artifact@v1
with:
name: built-output
path: ./dist
env:
NODE_OPTIONS: '--max-old-space-size=4096'
deploy-imjoy-core:
runs-on: ubuntu-latest
needs: test-and-build
if: github.ref == 'refs/heads/master'
steps:
- name: Load saved build output
uses: actions/download-artifact@v1
with:
name: built-output
path: ./dist
- name: Deploy imjoy-core to https://lib.imjoy.io
uses: peaceiris/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
deploy_key: ${{ secrets.ACTION_DEPLOY_KEY_FOR_LIB }}
external_repository: imjoy-team/lib.imjoy.io
publish_branch: master
publish_dir: ./dist
commit_message: Deployed from
cname: 'lib.imjoy.io'
publish-to-npm:
runs-on: ubuntu-latest
needs: test-and-build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13.14.0
registry-url: 'https://registry.npmjs.org'
- run: yarn
- name: Load saved build output
uses: actions/download-artifact@v1
with:
name: built-output
path: ./dist
- name: Publish if version has been updated
uses: oeway/[email protected]
with:
tag_name: "v%s"
tag_message: "v%s"
commit_pattern: "^Release (\\S+)"
commit_user: oeway
publish_with: yarn
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}