-
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 1.38 KB
/
ci.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
name: Staging
on:
push:
branches:
- staging
pull_request:
branches:
- staging
env:
BUILD: ./build
INDEX: ./build/index.html
jobs:
update_index_push_to_prod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Check for './build' and './build/index.html'
# Flatten directories
# Cleanup
# Push to production
- name: 🧐 Check for build
run: |
# ------------
# Ensure files
# ------------
declare -a missing
if ! [[ -d "$BUILD" ]]; then
missing+=("build")
fi
if ! [[ -f "$INDEX" ]]; then
missing+=("build/index.html")
fi
if ! [[ ${#missing[*]} -eq 0 ]]
then
echo "::error ::Missing files from 'staging' branch."
echo "Missing: ${missing[*]}"
exit 1
else
exit 0
fi
- name: Unpack subfolders to improve page navigation
run: mv $BUILD/* .
- name: 🧹 Cleanup
run: rmdir $BUILD
- name: Create .nojekyll file to avoid problems with CSS
run: touch .nojekyll
- name: 🚠 Push to production
uses: EndBug/add-and-commit@v9
with:
message: Deploying build
add: '.'
push: origin HEAD:production --force