ci(workflows): 重构 PyPI 发布流程为自定义步骤 #4
Workflow file for this run
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: Publish packages | |
| on: | |
| push: | |
| tags: ["*"] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| jobs: | |
| # GitHub Release (可选,用于创建 Release) | |
| github: | |
| uses: tree-sitter/workflows/.github/workflows/release.yml@main | |
| with: | |
| generate: true | |
| attestations: true | |
| # 只发布到 PyPI | |
| pypi: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/tree-sitter-arkts | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build setuptools wheel | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # NPM 发布 (暂时禁用) | |
| # npm: | |
| # uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main | |
| # secrets: | |
| # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
| # with: | |
| # generate: true | |
| # Crates.io 发布 (暂时禁用) | |
| # crates: | |
| # uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main | |
| # secrets: | |
| # CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} | |
| # with: | |
| # generate: true |