[v2] Generate Database and Deploy to Pages #217
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: "[v2] Generate Database and Deploy to Pages" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7 * * *" | |
push: | |
branches: | |
- v2 | |
paths: | |
- "main.py" | |
- "requirements.txt" | |
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: v2 | |
- 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 main.py | |
git config --local user.email "[email protected]" | |
git config --local user.name "Natsu Tadama" | |
git add . | |
git commit -m "Update JSON for v2 at $date $time" | |
git push | |
} | |
catch { | |
write-host "No changes made" | |
} |