瀏覽代碼

Update CI workflow and ignore Claude Code files

Updates GitHub Actions workflow to use modern versions and removes manual
directory creation now handled by the upgraded API script.

Workflow changes:
- Upgrade to latest action versions (checkout@v6, setup-python@v5)
- Use Ruby 3.3 and Python 3.14 for current language versions
- Separate build and deploy jobs following GitHub Pages best practices
- Replace deprecated peaceiris/actions-gh-pages with actions/deploy-pages
- Remove manual mkdir as api.py now handles directory creation automatically
- Trigger on pull requests for validation before merge

Also adds .claude directory to .gitignore to exclude Claude Code
configuration files from version control.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Thi Bot 2 周之前
父節點
當前提交
6f4dbe328a
共有 2 個文件被更改,包括 29 次插入19 次删除
  1. 28 19
      .github/workflows/main.yml
  2. 1 0
      .gitignore

+ 28 - 19
.github/workflows/main.yml

@@ -1,28 +1,37 @@
 name: CI
 
 on:
-  push: {branches: ["*", "*/*"]}
+  push:
+    branches: master
+  pull_request:
 
 jobs:
   build:
     runs-on: ubuntu-latest
 
     steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-ruby@v1
-      with:
-        ruby-version: '2.x'
-    - run: gem install awesome_bot
-    - run: awesome_bot README.md --request-delay 0.1 --allow-redirect --allow-dupe --allow-ssl
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-        architecture: 'x64'
-    - run: mkdir -p dist/api/v1/ && python .github/api.py
-    - name: deploy
-      if: github.ref == 'refs/heads/master'
-      uses: peaceiris/actions-gh-pages@v2.1.0
-      env:
-        ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
-        PUBLISH_BRANCH: gh-pages
-        PUBLISH_DIR: ./dist
+      - uses: actions/checkout@v6
+      - uses: ruby/setup-ruby@v1
+        with:
+          ruby-version: "3.3"
+      - run: gem install awesome_bot
+      - run: awesome_bot README.md --request-delay 0.1 --allow-redirect --allow-dupe --allow-ssl
+      - uses: actions/setup-python@v5
+        with:
+          python-version: "3.14"
+      - run: python .github/api.py
+      - uses: actions/upload-pages-artifact@v3
+        if: github.event_name == 'push' && github.ref == 'refs/heads/master'
+        with:
+          path: ./dist
+
+  deploy:
+    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
+    runs-on: ubuntu-latest
+    needs: build
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    steps:
+      - uses: actions/deploy-pages@v4
+        id: deployment

+ 1 - 0
.gitignore

@@ -64,6 +64,7 @@ bower_components
 .idea
 .vagrant
 .anaconda
+.claude
 
 # -------------------------------------------------
 # Generated files