Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03584d6

Browse files
feat: add pypi release workflow (#58)
* feat: add pypi release workflow Add a new GH workflow that will build and publish to PyPI when a new tag is pushed. * add test.pypi * add readme for publishing * remove test.pypi
1 parent 5b38a77 commit 03584d6

File tree

3 files changed

+93
-9
lines changed

3 files changed

+93
-9
lines changed

.github/workflows/release.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish Python distribution to PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Python
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.9"
15+
- name: Install and configure Poetry
16+
uses: snok/install-poetry@v1
17+
with:
18+
version: 1.5.1
19+
- name: Build a binary wheel and a source tarball
20+
run: poetry build
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v3
23+
with:
24+
name: python-package-distributions
25+
path: dist/
26+
27+
publish-to-pypi:
28+
name: >-
29+
Publish Python distribution to PyPI
30+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
31+
needs:
32+
- build
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: pypi
36+
url: https://pypi.org/p/stacklet.client.platform
37+
permissions:
38+
id-token: write # IMPORTANT: mandatory for trusted publishing
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v3
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
- name: Publish distribution to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
skip-existing: true
49+
verbose: true
50+
print-hash: true
51+
52+
github-release:
53+
name: >-
54+
Sign the Python distribution with Sigstore
55+
and upload to GitHub Release
56+
needs:
57+
- publish-to-pypi
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
61+
id-token: write # IMPORTANT: mandatory for sigstore
62+
steps:
63+
- name: Download all the dists
64+
uses: actions/download-artifact@v3
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
- name: Sign the dists with Sigstore
69+
uses: sigstore/[email protected]
70+
with:
71+
inputs: >-
72+
./dist/*.tar.gz
73+
./dist/*.whl
74+
- name: Upload artifact signatures to GitHub Release
75+
env:
76+
GITHUB_TOKEN: ${{ github.token }}
77+
# Upload to GitHub Release using the `gh` CLI.
78+
# `dist/` contains the built packages, and the
79+
# sigstore-produced signatures and certificates.
80+
run: >-
81+
gh release upload
82+
'${{ github.ref_name }}' dist/**
83+
--repo '${{ github.repository }}'

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,9 @@
33
## Installation
44

55
```
6-
$ just install
6+
$ pip install stacklet.client.platform
77
```
88

9-
## Compiling for distribution
10-
11-
```
12-
$ just compile
13-
```
14-
15-
This will create a `stacklet-admin` file which can be distributed. Compiling takes a long time (over 8 minutes). This file is git ignored.
16-
179
## Configuration
1810

1911
To get started, use the `auto-configure` command to initialize the CLI configuration
@@ -165,3 +157,11 @@ To return the last account:
165157
```
166158
stacklet-admin account list --last 1
167159
```
160+
161+
# Development
162+
163+
## Installation
164+
165+
```
166+
$ just install
167+
```

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ build-backend = "poetry.core.masonry.api"
66
name = "stacklet.client.platform"
77
version = "0.1.3"
88
description = "Stacklet Platform Client"
9+
readme = "README.md"
910
authors = [ "Sonny Shi <[email protected]>",]
1011
include = [ "stacklet/client/platform/vendored/auth_landing_pages/ok.html", "stacklet/client/platform/vendored/auth_landing_pages/fail.html",]
1112
[[tool.poetry.packages]]

0 commit comments

Comments
 (0)