-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add workflow for publishing releases #19
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
workflow_call: | ||
|
||
jobs: | ||
typecheck: | ||
|
@@ -17,9 +18,6 @@ jobs: | |
with: | ||
python-version: "3.13" | ||
- uses: pypa/hatch@install | ||
# TODO: remove after we release codex-sdk package (and are no longer installing from github) | ||
- name: setup git url rewrite | ||
run: git config --global url."https://${{ secrets.GH_USERNAME }}:${{ secrets.CLEANLAB_BOT_PAT }}@github.com".insteadOf ssh://[email protected] | ||
- run: hatch run types:check | ||
fmt: | ||
name: Format and lint | ||
|
@@ -43,7 +41,4 @@ jobs: | |
with: | ||
python-version: ${{ matrix.python }} | ||
- uses: pypa/hatch@install | ||
# TODO: remove after we release codex-sdk package (and are no longer installing from github) | ||
- name: setup git url rewrite | ||
run: git config --global url."https://${{ secrets.GH_USERNAME }}:${{ secrets.CLEANLAB_BOT_PAT }}@github.com".insteadOf ssh://[email protected] | ||
- run: hatch test -v --cover --include python=$(echo ${{ matrix.python }}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.0.1a1] - 2025-01-29 | ||
|
||
### Added | ||
|
||
- Pre-release of the Cleanlab Codex Python client. | ||
|
||
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a1...HEAD | ||
[0.0.1a1]: https://github.com/cleanlab/cleanlab-codex/compare/267a93300f77c94e215d7697223931e7926cad9e...v0.0.1a1 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1a1" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axl1313 do these links need to be manually updated as well? (I'm bumping the version in my refactor PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! Yeah they do. It'll just be updating the base commit for the [Unreleased] link to the new version tag and adding a link underneath the [Unreleased] link for the new version. Mind updating the DEVELOPMENT.md to mention this as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep I'll update DEVELOPMENT.md too! to confirm - I need to merge my PR first, and then create a 2nd PR to bump the version, right? because otherwise I won't have the squashed commit ID to reference in the link for my new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could do it as part of the same PR, since the link uses the tag rather than the actual commit hash. The link will just be broken for a little until you push the new tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good call! I updated it in my branch