Update data.json and build website #943
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: Update data.json and build website | |
on: | |
schedule: | |
- cron: '0 11 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Setup Git Profile | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- name: Update data.json | |
run: python3 update_data_json.py | |
- name: Add and commit files | |
run: | | |
git add data.json | |
set +e | |
git diff --cached --quiet | |
echo "modified=$?" >> $GITHUB_OUTPUT | |
set -e | |
id: status_add | |
- name: Commit files | |
if: steps.status_add.outputs.modified == '1' | |
run: | | |
git commit -m "Update data.json" | |
- name: Push changes | |
if: steps.status_add.outputs.modified == '1' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
- name: Build website | |
run: | | |
npm ci | |
npm run build | |
- name: Deploy to gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist | |
branch: gh-pages |