add release workflow + update version #1
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
| name: Build and publish package | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| jobs: | ||
| tests: | ||
| uses: ./.github/workflows/ci.yml | ||
|
Check failure on line 12 in .github/workflows/release.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-agility | ||
| 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-agility | ||
| path: dist | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||