name: Generate Timeline on: push: branches: [ "main", "master" ] paths: - 'scripts/generate_timeline.py' - 'scripts/data/timeline_data.csv' - '.github/workflows/generate_timeline.yml' workflow_dispatch: # Allows manual trigger from GitHub Actions UI jobs: build-and-release: runs-on: ubuntu-latest # 赋予 GITHUB_TOKEN 创建/更新 Release 的权限 permissions: contents: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install pandas matplotlib - name: Run timeline generation script run: | python scripts/generate_timeline.py - name: Update Latest Release with Image uses: softprops/action-gh-release@v2 with: tag_name: latest name: Latest Timeline Output body: "Auto-generated timeline image. Updated by CI." files: assets/timeline_output.png make_latest: true