Update site data #457
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 site data | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "0 0 * * *" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install data dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
working-directory: data | |
- name: Update data | |
run: python main.py globals,monsters,cards,maps | |
working-directory: data | |
env: | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
- name: Push data | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
git add .github | |
git add data | |
git add site/src/data | |
git add $(git ls-files -o --exclude-standard) | |
git commit -m "Update data" | |
git push | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install site dependencies | |
run: npm ci | |
working-directory: site | |
- name: Build site | |
run: npm run build | |
working-directory: site | |
- name: Deploy site | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: site/dist | |
clean: true | |
force: true |