[v3] Generate Database #118
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: "[v3] Generate Database" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * * *" | |
push: | |
branches: | |
- v3 | |
paths: | |
- "generator/*" | |
- "requirements.txt" | |
- "api/index.py" | |
- "api/robots.txt" | |
- "api/favicon.ico" | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
Build: | |
name: Build Database | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
ref: v3 | |
- name: Load secrets to environment variables | |
uses: oNaiPs/secrets-to-env-action@v1 | |
with: | |
secrets: ${{ toJSON(secrets) }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Install Dependencies | |
run: pip install -r requirements.txt | |
- name: Update JSON File with main.py and then commit | |
shell: pwsh | |
run: | | |
$date = Get-Date -Format "yyyy-MM-dd" | |
$time = Get-Date -Format "HH:mm:ss" | |
try { | |
python3 generator | |
git config --local user.email "[email protected]" | |
git config --local user.name "Natsu Tadama" | |
git add . | |
git commit -m "Update JSON for v3 at $date $time" | |
git push | |
} | |
catch { | |
write-host "No changes made" | |
} |