Skip to content

Commit 639df3c

Browse files
committed
github action for pypi build, publish and github release.
1 parent 7fd7a5e commit 639df3c

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

.github/workflows/pypi-build.yaml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414

1515
jobs:
1616
# Test the build with the latest CUDA toolkit and several Python versions
17-
nvcc-ubuntu:
17+
build:
1818
strategy:
1919
fail-fast: false
2020
matrix:
@@ -50,3 +50,66 @@ jobs:
5050
with:
5151
name: python-package-distributions
5252
path: dist/
53+
54+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
55+
publish-to-pypi:
56+
name: Publish GGNN package to PyPI
57+
if: startsWith(github.ref, 'refs/tags/')
58+
needs:
59+
- build
60+
runs-on: ubuntu-latest
61+
environment:
62+
name: pypi
63+
url: https://pypi.org/p/ggnn
64+
permissions:
65+
id-token: write
66+
67+
steps:
68+
- name: Download all the dists
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: python-package-distributions
72+
path: dist/
73+
- name: Publish distribution package to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
76+
github-release:
77+
name: Sign the Python distribution package with Sigstore and upload them to GitHub Release
78+
needs:
79+
- publish-to-pypi
80+
runs-on: ubuntu-latest
81+
82+
permissions:
83+
contents: write # IMPORTANT: mandatory for making GitHub Releases
84+
id-token: write # IMPORTANT: mandatory for sigstore
85+
86+
steps:
87+
- name: Download all the dists
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: python-package-distributions
91+
path: dist/
92+
- name: Sign the dists with Sigstore
93+
uses: sigstore/[email protected]
94+
with:
95+
inputs: >-
96+
./dist/*.tar.gz
97+
./dist/*.whl
98+
- name: Create GitHub Release
99+
env:
100+
GITHUB_TOKEN: ${{ github.token }}
101+
run: >-
102+
gh release create
103+
"$GITHUB_REF_NAME"
104+
--repo "$GITHUB_REPOSITORY"
105+
--notes ""
106+
- name: Upload artifact signatures to GitHub Release
107+
env:
108+
GITHUB_TOKEN: ${{ github.token }}
109+
# Upload to GitHub Release using the `gh` CLI.
110+
# `dist/` contains the built packages, and the
111+
# sigstore-produced signatures and certificates.
112+
run: >-
113+
gh release upload
114+
"$GITHUB_REF_NAME" dist/**
115+
--repo "$GITHUB_REPOSITORY"

0 commit comments

Comments
 (0)