Fix more posts #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |