Skip to content

Commit

Permalink
setup workflow to publish release
Browse files Browse the repository at this point in the history
  • Loading branch information
axl1313 committed Jan 29, 2025
1 parent 267a933 commit a843fa0
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches:
- main
workflow_call:

jobs:
typecheck:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build and publish package
on:
push:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
tests:
uses: ./.github/workflows/ci.yml

build:
name: Build package and upload artifacts
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install hatch
uses: pypa/hatch@install
- name: Check versions match
run: |
pkg_version=$(hatch version)
tag_version=${GITHUB_REF#refs/tags/v}
if [ "$pkg_version" != "$tag_version" ]; then
echo "Package version ($pkg_version) does not match git tag version ($tag_version)"
exit 1
fi
- name: Build package
run: hatch build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cleanlab-codex
path: dist/*
if-no-files-found: error

publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cleanlab-codex
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

upload-release:
name: Upload release to GitHub
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cleanlab-codex
path: dist
- name: Upload release
uses: softprops/action-gh-release@v1
with:
files: dist/*
body: ${{ steps.extract-release-notes.outputs.release-notes }}
draft: true
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Unreleased

## v0.1.0a0

Initial pre-release of the Cleanlab Codex Python client.
2 changes: 1 addition & 1 deletion src/cleanlab_codex/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# SPDX-License-Identifier: MIT
__version__ = "0.0.1"
__version__ = "0.0.1a0"

0 comments on commit a843fa0

Please sign in to comment.