-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (63 loc) · 2.04 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
name: Build
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
name: Build
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- folder: "dist/prod"
branch: "dist"
npmrunparam: "build"
- folder: "dist/sandbox"
branch: "dist-sandbox"
npmrunparam: "buildsandbox"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm install
- name: Build files
run: npm run ${{ matrix.npmrunparam }}
- name: Create scoring.json
# the output file name is relatived to create_scoring.sh,
run: |
./create_scoring/create_scroring_json.sh "../${{ matrix.folder }}/scoring.json"
echo "#####################"
find ./dist
- name: Commit built files to the ${{ matrix.branch }} branch
if: github.ref == 'refs/heads/master'
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: ${{ matrix.branch }}
FOLDER: ${{ matrix.folder }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy on staging
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
needs:
- build
steps:
- name: Deploy on staging
# CURL options:
# -f : GitHub workflow fail if the HTTP status code is not 200
# see API on https://infra.text-analytics.ch/api/webstatic/
# $GITHUB_REPOSITORY is replaced by the repository name, for example bitem-heg-geneve/ebiodiv-matching-frontend
run: |
curl -f -X 'POST' "https://infra.text-analytics.ch/api/webstatic/deploy/github.com/${{ github.repository }}/dist-sandbox" \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'secret_key=${{secrets.SECRET_KEY}}'