2022-03-27 04:16:16 +08:00
|
|
|
name: Update Calendar Data
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
2022-08-26 11:18:09 +08:00
|
|
|
- cron: "0 0 1 * *"
|
2022-03-27 04:16:16 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "**"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
main:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: ${{ github.head_ref }}
|
|
|
|
fetch-depth: 2
|
|
|
|
|
2022-09-20 02:43:37 +08:00
|
|
|
- name: Setup Python environment
|
2022-03-27 04:16:16 +08:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.9
|
|
|
|
|
|
|
|
- name: Install Python dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
|
|
2022-09-20 02:43:37 +08:00
|
|
|
- name: Run crawler script
|
2022-03-27 04:16:16 +08:00
|
|
|
shell: bash
|
|
|
|
run: python crawler.py
|
|
|
|
|
2022-09-20 02:43:37 +08:00
|
|
|
- name: Setup Go environment
|
2022-03-27 04:16:16 +08:00
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2022-08-26 11:18:09 +08:00
|
|
|
go-version: 1.19
|
2022-03-27 04:16:16 +08:00
|
|
|
|
|
|
|
- name: Go Build
|
|
|
|
run: go build -o . main
|
|
|
|
|
2022-09-20 02:43:37 +08:00
|
|
|
- name: Generate ICS files
|
2022-03-27 04:16:16 +08:00
|
|
|
run: ./main
|
|
|
|
|
|
|
|
- name: Commit changes
|
|
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
|
|
with:
|
|
|
|
file_pattern: docs/*.html docs/*.ics data/*.txt
|
|
|
|
commit_message: update calendar data automatically
|
|
|
|
commit_user_name: bugstop
|
2022-08-26 11:18:09 +08:00
|
|
|
commit_user_email: github@muhan.li
|
2022-03-27 04:16:16 +08:00
|
|
|
|
|
|
|
- name: Get last commit message
|
|
|
|
id: last-commit-message
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=msg::$(git log -1 --pretty=%s)"
|
|
|
|
|
|
|
|
- name: Update README
|
|
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
|
|
with:
|
|
|
|
file_pattern: README.md
|
|
|
|
commit_message: ${{ steps.last-commit-message.outputs.msg }}
|
|
|
|
commit_user_name: bugstop
|
|
|
|
commit_user_email: github@umm.one
|
|
|
|
commit_options: '--amend --no-edit'
|
|
|
|
push_options: '--force'
|
|
|
|
skip_fetch: true
|