From 7f56fa71fce0d7efba69795335551892b7eff48a Mon Sep 17 00:00:00 2001 From: Qi Zhao Date: Mon, 20 Jul 2026 20:06:17 +0800 Subject: [PATCH] Add trusted PyPI publishing --- .github/workflows/release.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 74fe5f8..c66bb50 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: release assets on: release: types: [published] + workflow_dispatch: permissions: contents: write @@ -20,7 +21,28 @@ jobs: - run: python -m pip install --upgrade pip build twine - run: python -m build - run: python -m twine check dist/* + - uses: actions/upload-artifact@v4 + with: + name: distributions + path: dist/ + if-no-files-found: error - name: Attach distributions to the GitHub release + if: github.event_name == 'release' env: GH_TOKEN: ${{ github.token }} run: gh release upload "${{ github.event.release.tag_name }}" dist/* --clobber + + publish: + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/aldes/ + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: distributions + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1