Skip to content

Commit 9939558

Browse files
Merge pull request #48 from kevinbackhouse/publish-to-testpypi
Workflow for publishing to TestPyPI
2 parents 0552f41 + e3c5fd1 commit 9939558

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Publish (reusable workflow)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
description: 'Version number or tag for the release. For example: v1.0.1'
8+
required: true
9+
type: string
10+
release_notes:
11+
description: 'Release notes'
12+
required: true
13+
type: string
14+
repository_url:
15+
description: 'This is the repository-url parameter for pypa/gh-action-pypi-publish'
16+
required: true
17+
type: string
18+
environment:
19+
description: 'PyPI/TestPyPI name and url are required'
20+
type: environment
21+
required: true
22+
secrets:
23+
GH_TOKEN:
24+
required: true
25+
26+
permissions:
27+
contents: write
28+
id-token: write # For trusted publishing
29+
30+
jobs:
31+
publish:
32+
name: Build
33+
runs-on: ubuntu-latest
34+
environment: ${{ inputs.environment }}
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
37+
GITHUB_REPO: ${{ github.repository }}
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
45+
with:
46+
python-version: "3.13"
47+
48+
- name: Install Hatch
49+
run: pip install --upgrade hatch
50+
51+
- name: Build the wheel
52+
run: python3 -m hatch build
53+
54+
- name: Upload artifacts
55+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
56+
with:
57+
name: python-package-distributions
58+
path: dist/
59+
60+
- name: Publish to PyPI
61+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
62+
with:
63+
repository-url: ${{ inputs.repository_url }}
64+
65+
- name: Sign with sigstore
66+
uses: sigstore/gh-action-sigstore-python@f832326173235dcb00dd5d92cd3f353de3188e6c # v3.1.0
67+
with:
68+
inputs: >-
69+
./dist/*.tar.gz
70+
./dist/*.whl
71+
72+
- name: Create GitHub Release
73+
env:
74+
VERSION: ${{ inputs.version }}
75+
NOTES: ${{ inputs.release_notes }}
76+
run: gh release create $VERSION --repo $GITHUB_REPO --notes $NOTES
77+
78+
- name: Upload GitHub Release
79+
env:
80+
VERSION: ${{ inputs.version }}
81+
run: gh release upload $VERSION dist/** --repo $GITHUB_REPO
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish to TestPyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version name for release'
8+
required: true
9+
10+
jobs:
11+
publish:
12+
name: Publish wheel to TestPyPI
13+
permissions:
14+
contents: write
15+
id-token: write # For trusted publishing
16+
uses: .github/workflows/publish-reusable.yml@main
17+
with:
18+
version: ${{ inputs.version }}
19+
release_notes: ${{ github.head_ref }}
20+
repository_url: https://test.pypi.org/legacy/
21+
environment:
22+
name: testpypi
23+
url: https://test.pypi.org/p/seclab-taskflow-agent2
24+
secrets:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)