This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (70 loc) · 2.72 KB
/
gh-pages-scheduled.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
name: Publish to GitHub Pages (scheduled)
on:
schedule:
- cron: '0 0 * * *'
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@v3
with:
path: ./mokk
- name: Checkout GitHub Pages environment
uses: actions/checkout@v3
with:
ref: gh-pages
path: ./gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
target: x86_64-unknown-linux-gnu
override: true
- name: Build GitHub grabber
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path mokk/grabber/Cargo.toml --release --all-features --target x86_64-unknown-linux-gnu
- name: Grab GitHub data
run: |
strip -v --strip-all ./mokk/grabber/target/x86_64-unknown-linux-gnu/release/grabber
chmod +x ./mokk/grabber/target/x86_64-unknown-linux-gnu/release/grabber
./mokk/grabber/target/x86_64-unknown-linux-gnu/release/grabber ./mokk
- name: Build
run: |
sudo apt-get -qq install tree > /dev/null
find ./gh-pages -mindepth 1 ! -regex '^./gh-pages/.git\(/.*\)?' -delete
cd ./mokk
printf "\nBuilding … \n" && dokkoo build .
cd ../
ls ./mokk
cp -ar ./mokk/output/* ./gh-pages
cp -ar ./mokk/assets ./gh-pages
cp -ar ./mokk/branding/vector ./gh-pages/assets/icons
cp -ar ./mokk/keybase.txt ./gh-pages
if [ -f "./gh-pages/postbuild.sh" ]; then
chmod +x ./gh-pages/postbuild.sh && ./gh-pages/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 'Dirout'
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