Skip to content

Commit 885be0c

Browse files
feat: adds release pipeline (#10)
* feat: adds release pipeline * Potential fix for code scanning alert no. 6: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 5bd1588 commit 885be0c

3 files changed

Lines changed: 148 additions & 4 deletions

File tree

.github/workflows/package.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Package and Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: "Version to publish (e.g., 1.0.0)"
13+
required: true
14+
type: string
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v6
28+
with:
29+
enable-cache: true
30+
cache-dependency-glob: "uv.lock"
31+
32+
- name: Install dependencies
33+
run: uv sync --locked --dev
34+
35+
- name: Determine version
36+
id: version
37+
run: |
38+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
39+
VERSION="${{ github.event.inputs.version }}"
40+
elif [[ "${{ github.event_name }}" == "release" ]]; then
41+
VERSION="${{ github.event.release.tag_name }}"
42+
VERSION="${VERSION#v}"
43+
else
44+
# Extract version from tag (remove 'v' prefix if present)
45+
VERSION="${GITHUB_REF#refs/tags/}"
46+
VERSION="${VERSION#v}"
47+
fi
48+
echo "version=$VERSION" >> $GITHUB_OUTPUT
49+
echo "Publishing version: $VERSION"
50+
51+
- name: Set package version
52+
run: |
53+
uv version ${{ steps.version.outputs.version }}
54+
55+
- name: Build package
56+
run: uv build
57+
58+
- name: Upload build artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: dist-${{ steps.version.outputs.version }}
62+
path: dist/
63+
64+
publish-github:
65+
needs: build
66+
runs-on: ubuntu-latest
67+
if: github.event_name == 'release' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
68+
permissions:
69+
contents: read
70+
packages: write
71+
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@v6
78+
with:
79+
enable-cache: true
80+
81+
- name: Determine version
82+
id: version
83+
run: |
84+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
85+
VERSION="${{ github.event.inputs.version }}"
86+
elif [[ "${{ github.event_name }}" == "release" ]]; then
87+
VERSION="${{ github.event.release.tag_name }}"
88+
VERSION="${VERSION#v}"
89+
else
90+
# Extract version from tag (remove 'v' prefix if present)
91+
VERSION="${GITHUB_REF#refs/tags/}"
92+
VERSION="${VERSION#v}"
93+
fi
94+
echo "version=$VERSION" >> $GITHUB_OUTPUT
95+
96+
- name: Download build artifacts
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: dist-${{ steps.version.outputs.version }}
100+
path: dist/
101+
102+
- name: Publish to GitHub Package Registry
103+
env:
104+
UV_PUBLISH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
run: |
106+
uv publish --publish-url https://pypi.pkg.github.com/${{ github.repository_owner }}/
107+
108+
release:
109+
needs: [build, publish-github]
110+
runs-on: ubuntu-latest
111+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
112+
permissions:
113+
contents: write
114+
115+
steps:
116+
- name: Download build artifacts
117+
uses: actions/download-artifact@v4
118+
with:
119+
name: dist-${{ steps.version.outputs.version }}
120+
path: dist/
121+
122+
- name: Create GitHub Release
123+
uses: softprops/action-gh-release@v1
124+
with:
125+
files: |
126+
dist/*.whl
127+
dist/*.tar.gz
128+
generate_release_notes: true
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
[project]
22
name = "athena_client"
3-
version = "0.1.0"
4-
description = "Athena Client Library"
3+
version = "0.0.0"
4+
description = "Python client library for Athena API - CSAM detection and content classification"
55
readme = "README.md"
66
authors = [
77
{ name = "Crisp Thinking Group Ltd", email = "opensource@kroll.com" },
88
]
9+
license = { text = "MIT" }
10+
keywords = ["csam", "content-detection", "image-classification", "api-client", "grpc"]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Intended Audience :: Developers",
14+
"License :: OSI Approved :: MIT License",
15+
"Programming Language :: Python :: 3.10",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
19+
]
920
requires-python = ">=3.10"
21+
repository = "https://github.com/crispthinking/athena-python-client"
22+
homepage = "https://github.com/crispthinking/athena-python-client"
23+
documentation = "https://crispthinking.github.io/athena-python-client/"
1024
dependencies = [
1125
"anyio>=4.10.0",
1226
"brotli>=1.1.0",

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)