perf: optimize resolve workflow and plugin listing #175
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: Tag on Release PR Merge | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| tag: | |
| if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract version from branch | |
| id: version | |
| run: | | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| TAG="${BRANCH#release/}" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "Tag to create: $TAG" | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Verify version in pyproject.toml | |
| run: | | |
| TAG="${{ steps.version.outputs.tag }}" | |
| VERSION="${TAG#v}" | |
| ACTUAL=$(grep -m1 '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| if [ "$ACTUAL" != "$VERSION" ]; then | |
| echo "::error::pyproject.toml version ($ACTUAL) does not match expected ($VERSION)" | |
| exit 1 | |
| fi | |
| - name: Check tag doesn't already exist | |
| run: | | |
| if git rev-parse "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then | |
| echo "::error::Tag ${{ steps.version.outputs.tag }} already exists" | |
| exit 1 | |
| fi | |
| - name: Create and push tag | |
| run: | | |
| git tag "${{ steps.version.outputs.tag }}" | |
| git push origin "${{ steps.version.outputs.tag }}" |