-
Notifications
You must be signed in to change notification settings - Fork 43
77 lines (64 loc) · 1.8 KB
/
update.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
# This is a basic workflow to help you get started with Actions
name: Build & Deploy
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- main
concurrency:
group: editor.opencast.org
cancel-in-progress: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 20
- name: Clean install
run: npm ci
- name: Build App
run: npm run build
# tests are currently failing
#- run: npm test
# env:
# CI: true
- name: Prepare git
run: |
git config --global user.name "Editor Deployment Bot"
git config --global user.email "[email protected]"
- name: Prepare GitHub SSH key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Clone repository
run: |
git clone "[email protected]:opencast/opencast-editor.git" ~/editor-clone
cd ~/editor-clone
git checkout gh-pages
- name: Commit new version
run: |
# store build
cp -r build ~/editor-build
# save CNAME
touch ~/editor-clone/CNAME
cp ~/editor-clone/CNAME ~/CNAME
# Update gh-pages
cd ~/editor-clone
git rm -rf .
cp ~/CNAME .
cp -r ~/editor-build/* .
git add ./*
git diff --staged --quiet || git commit -m "Build $(date)"
- name: Push updates
run: |
cd ~/editor-clone
git push origin gh-pages