chinese-holidays-calendar/.github/workflows/cd.yml

71 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2022-09-26 01:40:18 +08:00
name: Continuous Delivery
2022-03-27 04:16:16 +08:00
on:
workflow_dispatch:
schedule:
2024-05-02 12:58:19 +08:00
- cron: "0 0 1/16 * *"
2022-03-27 04:16:16 +08:00
push:
branches:
2022-09-26 01:40:18 +08:00
- "main"
2022-03-27 04:16:16 +08:00
jobs:
main:
runs-on: ubuntu-latest
steps:
2023-11-07 08:23:04 +08:00
- uses: actions/checkout@v4
2022-03-27 04:16:16 +08:00
with:
ref: ${{ github.head_ref }}
fetch-depth: 2
2022-09-20 02:43:37 +08:00
- name: Setup Python environment
2024-05-02 12:58:19 +08:00
uses: actions/setup-python@v5
2022-03-27 04:16:16 +08:00
with:
2024-05-02 12:58:19 +08:00
python-version: "3.12"
2022-03-27 04:16:16 +08:00
- 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
2024-10-19 01:54:00 +08:00
- name: Run global scripts
shell: bash
run: |
for script in global/*/main.py; do
cd $(dirname $script)
python $(basename $script)
done
2023-11-06 13:05:10 +08:00
- name: Setup Haskell and Cabal
uses: haskell-actions/setup@v2
2022-03-27 04:16:16 +08:00
with:
2024-05-02 12:58:19 +08:00
ghc-version: "9.6"
cabal-version: "3.10"
2022-03-27 04:16:16 +08:00
2023-11-07 08:23:04 +08:00
- name: Build parser
run: cabal build
2022-03-27 04:16:16 +08:00
2022-09-20 02:43:37 +08:00
- name: Generate ICS files
2023-11-06 13:05:10 +08:00
run: cabal run
2022-03-27 04:16:16 +08:00
2024-10-19 01:54:00 +08:00
- name: Generate global data
shell: bash
run: |
for script in global/*/deploy.sh; do
cd $(dirname $script)
bash $(basename $script) 2>/dev/null
done
2022-03-27 04:16:16 +08:00
- name: Commit changes
2023-11-07 08:23:04 +08:00
uses: stefanzweifel/git-auto-commit-action@v5
2022-03-27 04:16:16 +08:00
with:
2024-10-19 01:54:00 +08:00
file_pattern: README.md data/* global/*/data/* docs/* docs/global/*/*
2022-03-27 04:16:16 +08:00
commit_message: update calendar data automatically
2023-02-06 05:37:16 +08:00
commit_user_name: Muhan Li
2024-05-02 12:58:19 +08:00
commit_user_email: 77625954+muhav@users.noreply.github.com
commit_author: Muhan Li <77625954+muhav@users.noreply.github.com>