-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scaffold for automating GH Pages build
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: GH Pages deployment | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
gh-pages_build: | ||
name: Build GH Pages | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
COMMIT_AUTHOR: CIF-ontology Team | ||
COMMIT_AUTHOR_EMAIL: [email protected] | ||
BUILD_FOLDER: "ontology/build" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Python dependencies | ||
run: | ||
python -m pip install -U pip setuptools | ||
pip install -r ontology/gh_pages/requirements.txt | ||
|
||
- name: Make GH Pages | ||
run: # Command here to generate GH pages files | ||
|
||
- name: Commit to branch `gh-pages` | ||
run: ./ontology/gh_pages/commit.sh | ||
|
||
- name: Push changes to GitHub remote | ||
uses: ad-m/[email protected] | ||
with: | ||
branch: gh-pages | ||
force: true | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit with nonzero exit code if anything fails (-e) | ||
# Print all executed lines (-x) | ||
set -ex | ||
|
||
# Commit sha of main branch | ||
SHA=`git rev-parse --verify HEAD` | ||
TARGET_BRANCH="gh-pages" | ||
|
||
if [ "${GITHUB_ACTIONS}" != "true" ]; then | ||
echo "Skipping deploy; just doing a build." | ||
exit 0 | ||
fi | ||
|
||
# Move html to temp dir | ||
mv "${BUILD_FOLDER}" ../page-build | ||
git checkout "${TARGET_BRANCH}" || git checkout --orphan "${TARGET_BRANCH}" | ||
rm -rf * || exit 0 | ||
cp -r ../page-build/* . | ||
|
||
git config user.name "${COMMIT_AUTHOR}" | ||
git config user.email "${COMMIT_AUTHOR_EMAIL}" | ||
|
||
git add -A . | ||
# If there are no changes to the compiled out (e.g. this is a README update) then just bail. | ||
if git diff --cached --quiet; then | ||
echo "No changes to the output on this push; exiting." | ||
exit 0 | ||
fi | ||
|
||
git commit -m "Deploy to GitHub Pages: ${SHA}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jinja2==3.0.0rc1 |