Generate changelog.json from Releases #114
This file contains hidden or 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
| name: Generate changelog.json from Releases | |
| on: | |
| workflow_dispatch: # 手动触发 | |
| schedule: | |
| - cron: '0 0 * * *' | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-versions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 需要完整的 tag 历史 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: | | |
| npm install @octokit/rest dayjs | |
| - name: Generate changelogs.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node generate-changelog.js | |
| - name: Show generated JSON (for debug) | |
| run: cat changelog/changelog.json || true | |
| # 部署单个文件到 cf-page 分支 | |
| - name: 部署到 cf-page 分支 🚀 | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: cf-page | |
| folder: ./changelog | |
| target-folder: . | |
| clean: false | |
| commit-message: "chore: 每日更新 changelog.json (${{ github.run_id }})" | |