Skip to content

Commit 50ee9cf

Browse files
Add workflow
1 parent c7a6cff commit 50ee9cf

2 files changed

Lines changed: 64 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Build & publish
3+
4+
jobs:
5+
6+
build:
7+
name: Build wheel
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.8"
19+
20+
- name: Install hatch
21+
run: python3 -m pip install hatch --user
22+
23+
- name: Build
24+
run: hatch build -t wheel
25+
26+
- name: Save wheel as artifact
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish:
33+
name: Create GitHub release & publish to PyPI
34+
# only publish to PyPI on tag pushes
35+
if: startsWith(github.ref, 'refs/tags/')
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/rocketgate
42+
permissions:
43+
id-token: write
44+
45+
steps:
46+
- name: Environment
47+
run: echo "RELEASE_VERSION=$(git describe --tags)" > $GITHUB_ENV
48+
49+
- name: Download wheel artifact
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
55+
- name: GitHub Release
56+
uses: softprops/action-gh-release@v1
57+
with:
58+
body: ${{ github.event.workflow_run.head_commit.message }}
59+
files: dist/rocketgate-${{ env.RELEASE_VERSION }}.whl
60+
61+
- name: Publish
62+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ tests/__pycache__
44
tests/.DS_Store
55
.DS_Store
66
/venv
7-
/dist
7+
/.venv
8+
/dist

0 commit comments

Comments
 (0)