-
Notifications
You must be signed in to change notification settings - Fork 4
81 lines (67 loc) · 2.41 KB
/
build_deploy.yaml
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: Continuous Integration and Deployment of nimh-minimal
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Set Environment Variable
run: |
echo "PROTOCOL_SLUG=nimh_minimal" >> $GITHUB_ENV
- name: Echo Environment Variable
run: |
echo "PROTOCOL_SLUG is set to $PROTOCOL_SLUG"
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetches the entire history for comprehensive CI checks
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '14.x' # Updated to a more recent LTS version
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Updated to Python 3.9
- name: Install system dependencies
run: sudo apt-get install jq
- name: Read Checksum from config.env
run: |
echo "Reading checksum..."
CHECKSUM=$(cat config.env | grep REPROSCHEMA_UI_CHECKSUM | cut -d '=' -f2)
echo "LATEST_COMMIT_HASH=${CHECKSUM}" >> $GITHUB_ENV
- name: Install Node dependencies and validate JSON
run: |
npm install -g jsonlint
grep -r "@context" activities | cut -d: -f1 | xargs -I {} jsonlint -q {}
grep -r "@context" $PROTOCOL_SLUG | cut -d: -f1 | xargs -I {} jsonlint -q {}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install reproschema requests_cache pre-commit
- name: Test with pyshacl
run: |
reproschema -l DEBUG validate activities
reproschema -l DEBUG validate ${PROTOCOL_SLUG}/${PROTOCOL_SLUG}_schema
- name: Build and prepare UI
run: |
curl -O -sSL https://github.com/ReproNim/reproschema-ui/archive/${LATEST_COMMIT_HASH}.zip
unzip ${LATEST_COMMIT_HASH}.zip
mv reproschema-ui-* ui
cd ui
cp -r ../ui-changes/. .
# Modify the title in index.html
sed -i 's/<title>.*<\/title>/<title>nimh-minimal<\/title>/' public/index.html
npm install
npm run build
touch dist/.nojekyll
- name: Deploy to GitHub Pages 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: ui/dist