Auto-build HTML files #787
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: Auto-build HTML files | |
on: | |
push: | |
branches: | |
- working | |
schedule: | |
- cron: '0 8 * * *' # Runs at 8:00 AM UTC every day | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- name: Load repository | |
uses: actions/checkout@v2 | |
- name: Switch to the master branch (or create it if it doesn't exist) | |
run: | | |
git checkout -B master | |
- name: Reset master to point to working's HEAD | |
run: | | |
git fetch --all --no-tags | |
git reset --hard origin/working | |
git status | |
- name: Pull in comic_git_engine | |
run: | | |
export ENGINE_VERSION=$(sed -n 's/Engine version = \(.*\)/\1/p' your_content/comic_info.ini) | |
echo "Engine version: $ENGINE_VERSION" | |
git submodule add -b $ENGINE_VERSION -f https://github.com/ryanvilbrandt/comic_git_engine | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r comic_git_engine/scripts/requirements.txt | |
python comic_git_engine/scripts/make_requirements_hooks_file.py | |
pip install -r comic_git_engine/scripts/requirements_hooks.txt | |
- name: Run python build script | |
run: | | |
python comic_git_engine/scripts/build_site.py --delete-scheduled-posts | |
- name: Commit files | |
run: | | |
git config --local user.name "Github Action" | |
git config --local user.email "action@github.com" | |
git add --all | |
git diff-index --quiet HEAD || git commit -m "Auto-build" | |
- name: Push changes | |
run: | | |
git push -f --set-upstream origin master |