Generate Daily Report #226
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Generate Daily Report | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: "0 20 * * *" | |
workflow_dispatch: | |
env: | |
GITHUB_NAME: Bye-lemon | |
GITHUB_EMAIL: [email protected] | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TZ: Asia/Shanghai | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Debug timezone | |
run: | | |
date | |
- name: Install the latest version of rye | |
uses: eifinger/setup-rye@v1 | |
with: | |
enable-cache: true | |
cache-prefix: 'optional-prefix' | |
- name: Install dependencies | |
run: | | |
rye sync | |
- name: Generate daily report | |
run: | | |
rye run python main.py | |
- name: Push daily report | |
run: | | |
git config --local user.email "${{ env.GITHUB_EMAIL }}" | |
git config --local user.name "${{ env.GITHUB_NAME }}" | |
git add . | |
git commit -m 'ci: daily auto update' || echo "nothing to commit" | |
git push || echo "nothing to push" | |
deploy: | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |