-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (58 loc) · 2.31 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
# General notes on github actions: Note that both the working directory
# and environment variables generally are not shared between steps.
name: deploy furl
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 furl repo on current branch # STEP 1
uses: actions/checkout@v2
with:
path: source
- name: Add name of current branch to environment as BRANCH_NAME
uses: nelonoel/branch-name@v1.0.1
- name: Retrieve build environment if cached # STEP 2
id: opam-cache
uses: actions/cache@v2
with:
path: '/home/runner/.opam/'
key: ${{ runner.os }}-modules-${{ hashFiles('./source/opam.export') }}
- name: Install dependencies and build furl # STEP 3
run: |
sudo apt --assume-yes install opam
export OPAMYES=1
opam init --compiler=ocaml-base-compiler.4.08.1
eval $(opam env)
make deps
make release
working-directory: ./source
- name: Checkout website build artifacts repo # STEP 4
uses: actions/checkout@v2
with:
repository: disconcision/disconcision.github.io
token: ${{ secrets.DEPLOY_FURL }}
path: server
- name: Clear any old build of this branch # STEP 5
run: if [ -d "furl/${BRANCH_NAME}" ] ; then rm -rf "furl/${BRANCH_NAME}" ; fi
working-directory: ./server
- name: Copy in newly built source # STEP 6
run: |
mkdir "./server/furl/${BRANCH_NAME}" &&
cp -r "./source/_build/default/src/web/www"/* "./server/furl/${BRANCH_NAME}" &&
if [ "${BRANCH_NAME}" == "plus" ]
then
cp -r "./source/_build/default/src/web/www"/* "./server/furl"
fi
- name: Commit to website aka deploy # STEP 7
run: |
git config user.name github-deploy-action
git config user.email furl-deploy@disconcision.com
git add -A
git status
git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push)
working-directory: ./server