-
Notifications
You must be signed in to change notification settings - Fork 52
74 lines (74 loc) · 2.84 KB
/
deploy_branches.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
# General notes on github actions: Note that both the working directory
# and environment variables generally are not shared between steps.
name: Build and Deploy Hazel
on: [push]
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
# NOTE: position the below lines in the code between two steps
# and uncomment them to open an ssh connection at that point:
#- name: Debugging with ssh
# uses: lhotari/action-upterm@v1
- name: Checkout the hazel repo on the current branch # STEP 1
uses: actions/checkout@v2
with:
path: source
- name: Add the name of the current branch to the environment as BRANCH_NAME
uses: nelonoel/[email protected]
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 5.0.0
dune-cache: true
- name: Install dependencies
run: |
eval $(opam env)
make deps
working-directory: ./source
- name: Build Hazel
run: |
eval $(opam env)
make release
working-directory: ./source
- name: Run Tests
id: test
continue-on-error: true
run: |
eval $(opam env)
node _build/default/src/test/haz3ltest.bc.js > test_output
if [ $? -eq 0 ]; then
echo "::set-output name=tests_passed::true"
else
echo "::set-output name=tests_passed::false"
fi
working-directory: ./source
- uses: LouisBrunner/[email protected]
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test Results
conclusion: ${{ steps.test.outputs.tests_passed == 'true' && 'success' || 'failure' }}
output_text_description_file: ./source/test_output
output: |
{"summary":"${{ steps.test.outputs.tests_passed == 'true' && 'Tests Passed' || 'Tests Failed' }}"}
- name: Checkout the website build artifacts repo # STEP 4
uses: actions/checkout@v2
with:
repository: hazelgrove/build
token: ${{ secrets.ACCESS_TOKEN }}
path: server
- name: Clear any old build of this branch # STEP 5
run: if [ -d "${BRANCH_NAME}" ] ; then rm -rf "${BRANCH_NAME}" ; fi
working-directory: ./server
- name: Copy in the newly built source # STEP 6
run: mkdir "./server/${BRANCH_NAME}" && cp -r "./source/_build/default/src/haz3lweb/www"/* "./server/${BRANCH_NAME}"
- name : Commit to the website aka deploy # STEP 7
run: |
git config user.name github-deploy-action
git config user.email [email protected]
git add -A
git pull --no-edit
git status
git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push)
working-directory: ./server