Update pydantic requirement from >=2.11.4 to >=2.13.3 #126
Workflow file for this run
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: Release on Merge | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| jobs: | |
| check-release-branch: | |
| runs-on: ubuntu-latest | |
| # This if clause ensures the job only runs when the PR is merged | |
| # and the branch starts with release/ | |
| if: | | |
| github.event.pull_request.merged == true && | |
| startsWith(github.event.pull_request.head.ref, 'release/') | |
| outputs: | |
| valid_release: ${{ steps.validate.outputs.valid_release }} | |
| version: ${{ steps.validate.outputs.version }} | |
| steps: | |
| - name: Validate release branch and extract version | |
| id: validate | |
| run: | | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| if [[ "$BRANCH" =~ ^release/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "valid_release=true" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Branch name valid for release: $BRANCH" | |
| else | |
| echo "valid_release=false" >> "$GITHUB_OUTPUT" | |
| echo "version=" >> "$GITHUB_OUTPUT" | |
| echo "Branch '$BRANCH' does not match release/X.Y.Z (semver) pattern. Skipping release." | |
| fi | |
| do-release: | |
| needs: check-release-branch | |
| if: needs.check-release-branch.outputs.valid_release == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION: ${{ needs.check-release-branch.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Check Version Consistency | |
| id: version_check | |
| run: | | |
| BRANCH_VERSION="${{ env.VERSION }}" | |
| # Safely extract __version__ from the file regardless of single or double quotes, | |
| # e.g. __version__ = '1.0.0' or __version__ = "1.0.0" | |
| CODE_VERSION=$(grep -Po "__version__\s*=\s*['\"]\K[^'\"]+" src/docbuild/__about__.py) | |
| echo ":notice title=Branch version::$BRANCH_VERSION" | |
| echo ":notice title=Code version::$CODE_VERSION" | |
| if [ "$BRANCH_VERSION" != "$CODE_VERSION" ]; then | |
| echo "::error file=src/docbuild/__about__.py::Release branch version ($BRANCH_VERSION) does not match code version ($CODE_VERSION) in __about__.py." | |
| echo "ERROR: Version mismatch detected! The release branch name must exactly match the __version__ in the code." | |
| exit 1 | |
| fi | |
| echo "Version check passed: $BRANCH_VERSION matches $CODE_VERSION." | |
| - name: Setup uv | |
| id: setup-uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-suffix: "docbuild" | |
| - name: Print the installed version | |
| run: | | |
| echo "uv version is ${{ steps.setup-uv.outputs.uv-version }}" | |
| - name: Tag new release | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git tag "${{ env.VERSION }}" | |
| git push origin "${{ env.VERSION }}" | |
| - name: Build wheel | |
| run: uv build --wheel | |
| - name: Generate GitHub Release & Upload wheel | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| generate_release_notes: true | |
| files: dist/*.whl | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |