2022-09-05 21:06:15 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
BRANCH="gh-pages"
|
|
|
|
|
2022-09-07 16:23:13 +00:00
|
|
|
current_time() {
|
|
|
|
|
|
|
|
TIME=$(date -u --rfc-3339=seconds)
|
|
|
|
|
|
|
|
DATE=$(echo $TIME | cut -d' ' -f1)
|
|
|
|
HOUR=$(echo $TIME | cut -d' ' -f2)
|
|
|
|
|
|
|
|
VALID_TIME=${DATE}T${HOUR}
|
|
|
|
|
|
|
|
echo $VALID_TIME
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-09-05 21:06:15 +00:00
|
|
|
build() {
|
|
|
|
echo "Starting building..."
|
|
|
|
|
2022-09-07 16:23:13 +00:00
|
|
|
TIME=$(current_time)
|
|
|
|
|
|
|
|
printf "+++\ntitle = \"CHANGELOG\"\ndate = $TIME\nupdated = $TIME\ndraft = false\nweight = 410\nsort_by = \"weight\"\ntemplate = \"docs/page.html\"\n\n[extra]\ntoc = true\ntop = false\n+++\n\n" > docs/content/docs/CHANGELOG.md
|
|
|
|
|
|
|
|
cat CHANGELOG.md >> docs/content/docs/CHANGELOG.md
|
|
|
|
|
|
|
|
printf "+++\ntitle = \"README\"\ndate = $TIME\nupdated = $TIME\ndraft = false\nweight = 410\nsort_by = \"weight\"\ntemplate = \"docs/page.html\"\n\n[extra]\ntoc = true\ntop = false\n+++\n\n" > docs/content/docs/README.md
|
|
|
|
|
|
|
|
cat README.md >> docs/content/docs/README.md
|
|
|
|
|
|
|
|
|
|
|
|
cp -R docs ../docs_backup
|
|
|
|
rm -r *
|
|
|
|
cp -R ../docs_backup ./docs
|
2022-09-05 21:06:15 +00:00
|
|
|
cd docs
|
|
|
|
|
|
|
|
sudo snap install --edge zola
|
|
|
|
zola build
|
|
|
|
mv public /tmp/public
|
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
|
|
|
deploy() {
|
|
|
|
echo "Starting deploying..."
|
|
|
|
git config --global url."https://".insteadOf git://
|
|
|
|
git config --global url."https://github.com/".insteadOf git@github.com:
|
|
|
|
|
|
|
|
git checkout ${BRANCH}
|
|
|
|
cp -vr /tmp/public/* .
|
|
|
|
git config user.name "GitHub Actions"
|
|
|
|
git config user.email "github-actions-bot@users.noreply.github.com"
|
2022-09-07 16:23:13 +00:00
|
|
|
|
|
|
|
rm -r docs/themes
|
2022-09-05 21:06:15 +00:00
|
|
|
git add .
|
|
|
|
git commit -m "Deploy new version docs"
|
|
|
|
git push --force "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ${BRANCH}
|
|
|
|
|
|
|
|
echo "Deploy complete"
|
|
|
|
}
|