-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.86 KB
/
gh-pages.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
name: Publish to GitHub Pages
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: "Publish"
steps:
- name: Install Dokkoo
run: |
curl -s https://raw.githubusercontent.com/Dirout/dokkoo/master/Cargo.toml --output Cargo.toml > /dev/null
version=$( awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' Cargo.toml )
curl -s -L https://github.com/Dirout/dokkoo/releases/download/v${version}/dokkoo_${version}_amd64.deb --output dokkoo_${version}_amd64.deb > /dev/null
sudo apt-get -qq install ./dokkoo_${version}_amd64.deb > /dev/null
printf "Installed Dokkoo v${version}"
- name: Checkout Mokk
uses: actions/checkout@v2
with:
path: ./mokk
- name: Checkout GitHub Pages environment
uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
sudo apt-get -qq install tree > /dev/null
printf "Files to build:\n" && tree ./mokk
find ./gh-pages -mindepth 1 ! -regex '^./gh-pages/.git\(/.*\)?' -delete
cd ./mokk
printf "\nBuilding … \n" && dokkoo build .
cd ../
cp -ar ./mokk/output/* ./gh-pages
if [ -f "./mokk/postbuild.sh" ]; then
chmod +x ./mokk/postbuild.sh && ./mokk/postbuild.sh
fi
touch ./gh-pages/.nojekyll
tee -a ./gh-pages/.nojekyll > /dev/null <<EOT
EOT
printf "\nFiles to publish:\n" && tree ./gh-pages
- name: Publish
run: |
cd ./gh-pages
git config --global user.name 'Dokkoo'
git config --global user.email '[email protected]'
git add -A
git diff --quiet && git diff --staged --quiet || git commit -am "Publish Mokk to GitHub Pages"
git push