revert release for testing #2
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: "Publish" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'codeflash/version.py' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| permissions: | |
| id-token: write | |
| contents: write # Changed from 'read' to 'write' to allow tag creation | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper versioning | |
| - name: Extract version from version.py | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -oP '__version__ = "\K[^"]+' codeflash/version.py) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Check if tag already exists | |
| id: check_tag | |
| run: | | |
| if git rev-parse "v${{ steps.extract_version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Tag v${{ steps.extract_version.outputs.version }} already exists, skipping release" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Tag v${{ steps.extract_version.outputs.version }} does not exist, proceeding with release" | |
| fi | |
| - name: Create and push git tag | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "${{ steps.extract_version.outputs.tag }}" -m "Release ${{ steps.extract_version.outputs.tag }}" | |
| git push origin "${{ steps.extract_version.outputs.tag }}" | |
| - name: Install uv | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Build | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: uv build | |
| # Check that basic features work and we didn't miss to include crucial files | |
| - name: Smoke test (wheel) | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py | |
| - name: Smoke test (source distribution) | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py | |
| - name: Publish to PyPI | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: uv publish | |
| - name: Create GitHub Release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.extract_version.outputs.tag }} | |
| name: Release ${{ steps.extract_version.outputs.tag }} | |
| body: | | |
| ## What's Changed | |
| Release ${{ steps.extract_version.outputs.version }} of codeflash. | |
| **Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ steps.extract_version.outputs.tag }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| dist/* |