Repository navigation
ci: add PyPI release workflow for v0.1.0 [OMN-7647] #8
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 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 hidden or 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,41 @@ | ||
| # SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. | ||
| # SPDX-License-Identifier: MIT | ||
| name: Release Dry Run | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Version tag to simulate (e.g. v0.1.0)' | ||
| required: true | ||
|
|
||
| jobs: | ||
| dry-run: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Validate tag matches pyproject.toml version | ||
| run: | | ||
| TAG="${{ inputs.tag }}" | ||
| TAG="${TAG#v}" | ||
| PKG_VERSION=$(python3 -c " | ||
| import tomllib | ||
| with open('pyproject.toml', 'rb') as f: | ||
| print(tomllib.load(f)['project']['version']) | ||
| ") | ||
| if [ "$TAG" != "$PKG_VERSION" ]; then | ||
| echo "ERROR: input tag v${TAG} does not match pyproject.toml version $PKG_VERSION" | ||
| exit 1 | ||
| fi | ||
| echo "Version validated: $PKG_VERSION" | ||
| - name: Build only (no publish) | ||
| run: uv build | ||
| - name: Verify artifacts | ||
| run: | | ||
| ls dist/*.whl dist/*.tar.gz | ||
| sha256sum dist/*.whl dist/*.tar.gz | ||
This file contains hidden or 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,103 @@ | ||
| # SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. | ||
| # SPDX-License-Identifier: MIT | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: ['v[0-9]*.[0-9]*.[0-9]*'] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Version tag to release (e.g. v0.1.0)' | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.repository }}-${{ github.ref_name }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.tag.outputs.tag }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} | ||
|
|
||
| - name: Assert clean working tree | ||
| run: | | ||
| git diff --exit-code | ||
| git diff --cached --exit-code | ||
| test -z "$(git ls-files --others --exclude-standard)" | ||
|
|
||
| - name: Validate tag matches pyproject.toml version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| TAG="${{ inputs.tag }}" | ||
| else | ||
| TAG="${GITHUB_REF_NAME}" | ||
| fi | ||
| TAG="${TAG#v}" | ||
| PKG_VERSION=$(python3 -c " | ||
| import tomllib, sys | ||
| with open('pyproject.toml', 'rb') as f: | ||
| d = tomllib.load(f) | ||
| v = d.get('project', {}).get('version') | ||
| if not v: | ||
| raise SystemExit('ERROR: missing [project].version in pyproject.toml') | ||
| print(v) | ||
| ") | ||
| if [ "$TAG" != "$PKG_VERSION" ]; then | ||
| echo "ERROR: tag v${TAG} does not match pyproject.toml version $PKG_VERSION" | ||
| exit 1 | ||
| fi | ||
| echo "Version validated: $PKG_VERSION" | ||
|
|
||
| - uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Build wheel + sdist | ||
| run: uv build | ||
|
|
||
| - name: Verify dist artifacts exist | ||
| run: | | ||
| ls -la dist/ | ||
| ls dist/*.whl dist/*.tar.gz >/dev/null 2>&1 || { | ||
| echo "ERROR: expected wheel + sdist in dist/" | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Publish to PyPI | ||
| run: | | ||
| uv publish --token "$UV_PUBLISH_TOKEN" dist/*.whl dist/*.tar.gz | ||
| env: | ||
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
|
|
||
| - name: Generate checksums | ||
| run: sha256sum dist/*.whl dist/*.tar.gz > dist/SHA256SUMS.txt | ||
|
|
||
| - name: Set release tag | ||
| id: tag | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ steps.tag.outputs.tag }} | ||
| files: | | ||
| dist/*.whl | ||
| dist/*.tar.gz | ||
| dist/SHA256SUMS.txt | ||
| generate_release_notes: true | ||
| prerelease: ${{ contains(steps.tag.outputs.tag, 'rc') }} | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.