Index and Deploy to GitHub Pages #67
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: Index and Deploy to GitHub Pages | |
on: | |
workflow_run: | |
workflows: ["Fetch and Beautify Fortnite Festival Content API"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyyaml | |
- name: Generate link tree | |
run: python link_tree.py | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add _data/files.yml | |
git commit -m 'Update files.yml' || echo "No changes to commit" | |
git push || echo "Nothing to push" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3.5' | |
- name: Install Bundler | |
run: gem install bundler -v 2.5.21 | |
- name: Install Jekyll dependencies | |
run: bundle _2.5.21_ install | |
- name: Build Jekyll site | |
run: bundle exec jekyll build | |
- name: Remove unwanted files from _site | |
run: | | |
rm -f _site/fetch_and_reformat.py | |
rm -f _site/link_tree.py | |
rm -f _site/requirements.txt | |
- name: List Jekyll site directory | |
run: ls -la _site | |
- name: List working directory | |
run: ls -la | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: _site | |
clean: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |