Skip to content

Commit ae5e1e7

Browse files
committed
feat(ci): Add release workflow
This adds a workflow to build the Python package when a tag matching `feature_artifacts-helper_*` is created. It will upload the build artifacts (`tar.gz` sdist and `.whl` bdist). There is also the option of automatically creating a release and attaching the build artifacts to it. See eebf0a5 and https://github.com/delilahw/codespace-features/releases/tag/feature_artifacts-helper_1.1-alpha for an example.
1 parent 67b08fa commit ae5e1e7

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Artifacts Helper Keyring Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- "feature_artifacts-helper_*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
defaults:
13+
run:
14+
working-directory: src/artifacts-helper/codespaces_artifacts_helper_keyring
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: wntrblm/nox@main
20+
with:
21+
python-versions: "3.11, 3.12"
22+
23+
- name: Setup PDM
24+
uses: pdm-project/setup-pdm@v4
25+
with:
26+
version: "2.15.1"
27+
python-version-file: "src/artifacts-helper/codespaces_artifacts_helper_keyring/pyproject.toml"
28+
29+
- name: Run nox release
30+
run: pdm release
31+
32+
- name: Upload build artifacts
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: codespaces_artifacts_helper_keyring
36+
path: |
37+
src/artifacts-helper/codespaces_artifacts_helper_keyring/dist

src/artifacts-helper/codespaces_artifacts_helper_keyring/noxfile.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,14 @@ def mypy(session):
6161
session.run_always("pdm", "install", external=True)
6262
args = session.posargs or LOCATIONS
6363
session.run("mypy", *args)
64+
65+
66+
@nox.session(py=DEFAULT_PYTHON_VERSION)
67+
def release(session):
68+
"""Build the package only.
69+
70+
Usually, this would also upload the package to PyPI, but we only publish to
71+
GitHub Releases in this project. See the `release-keyring.yaml` workflow.
72+
"""
73+
session.run_always("pdm", "install", external=True)
74+
session.run("pdm", "build", external=True)

0 commit comments

Comments
 (0)