|
2 | 2 | push: |
3 | 3 | pull_request: |
4 | 4 |
|
| 5 | +permissions: |
| 6 | + contents: write |
| 7 | + id-token: write |
| 8 | + pages: write |
| 9 | + |
5 | 10 | jobs: |
6 | 11 | build: |
7 | 12 | strategy: |
|
54 | 59 | name: commands-mcp_${{ matrix.name }} |
55 | 60 | path: target/${{ matrix.target }}/release/commands-mcp${{ matrix.suffix }} |
56 | 61 |
|
| 62 | + - name: Archive schema.json |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + if: matrix.name == 'linux-x64' |
| 65 | + with: |
| 66 | + name: schema |
| 67 | + path: commands.schema.json |
| 68 | + |
57 | 69 | pack-npm: |
58 | 70 | runs-on: ubuntu-latest |
59 | 71 | needs: build |
|
87 | 99 | with: |
88 | 100 | name: npm-tarball |
89 | 101 | path: ${{ steps.pack.outputs.tarball }} |
| 102 | + |
| 103 | + schema-pack: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + needs: build |
| 106 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v')) |
| 107 | + steps: |
| 108 | + - name: Checkout schema branch |
| 109 | + uses: actions/checkout@v4 |
| 110 | + with: |
| 111 | + ref: schema |
| 112 | + path: schema |
| 113 | + fetch-depth: 0 |
| 114 | + |
| 115 | + - name: Download schema.json |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + name: schema |
| 119 | + |
| 120 | + - name: Commit and push |
| 121 | + run: | |
| 122 | + mv -v commands.schema.json schema/${{ github.ref_name }}.json |
| 123 | + cd schema |
| 124 | + git config --local user.name "xychen" |
| 125 | + git config --local user.email "[email protected]" |
| 126 | + if [[ -z "$(git status --porcelain)" ]]; then |
| 127 | + echo "No changes to commit" |
| 128 | + else |
| 129 | + git add ${{ github.ref_name }}.json |
| 130 | + git commit -m "Update schema for ${{ github.ref_name }}" |
| 131 | + git push |
| 132 | + fi |
| 133 | +
|
| 134 | + - name: Upload Pages artifact |
| 135 | + uses: actions/upload-pages-artifact@v3 |
| 136 | + with: |
| 137 | + path: ${{ github.workspace }} |
| 138 | + |
| 139 | + schema-deploy: |
| 140 | + runs-on: ubuntu-latest |
| 141 | + needs: schema-pack |
| 142 | + |
| 143 | + environment: |
| 144 | + name: github-pages |
| 145 | + url: ${{ steps.deploy.outputs.page_url }} |
| 146 | + |
| 147 | + steps: |
| 148 | + - name: Deploy to GitHub Pages |
| 149 | + uses: actions/deploy-pages@v4 |
| 150 | + id: deploy |
0 commit comments