Fetch and gernerate all #296
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
# https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions | |
name: Fetch and gernerate all | |
# Controls when the workflow will run | |
on: | |
workflow_dispatch: | |
schedule: | |
# minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday). | |
- cron: "0 22 * * 0" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/README.md" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
# env: | |
# GO111MODULE: on | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# - name: Setup Go environment | |
# uses: actions/setup-go@v3 | |
# - name: Setup Rust environmet | |
# uses: dtolnay/rust-toolchain@stable | |
- name: Install packages. | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3 | |
shell: bash | |
- name: Set variables | |
run: | | |
# echo "PATH=$(go env GOPATH)/bin:${PATH}" >> $GITHUB_ENV | |
echo "RELEASE_NAME=$(date -u +%Y.%m.%d)" >> $GITHUB_ENV | |
shell: bash | |
# https://github.com/actions/checkout | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
# Relative path under $GITHUB_WORKSPACE to place the repository | |
path: src | |
- name: Run main_fetch_and_gernerate.py | |
run: | | |
cd src && pwd && python3 main_fetch_and_gernerate.py | |
shell: bash | |
- name: Git push results to "main" branch | |
# if: ${{ github.event_name == 'schedule' }} | |
run: | | |
cd src && pwd | |
git config user.name 'github-actions' | |
git config user.email '[email protected]' | |
git add . | |
[ -n "$(git status -s)" ] && git commit -m "github-action-${{ env.RELEASE_NAME }}" || echo "Nothing to commit!" | |
git push | |
shell: bash |