server/v0.11.0 #54
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 Schema | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Prefixed tag to release (e.g. schema/0.1.0)" | |
| required: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| release: | |
| name: Publish cq-schema to PyPI | |
| # Skip early for non-schema releases (no runner cost). The Go module | |
| # publishes implicitly via the tag itself; PyPI is the only artifact | |
| # that needs an explicit upload step. | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'release' && startsWith(github.event.release.tag_name, 'schema/')) | |
| environment: pypi | |
| permissions: | |
| contents: read | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Resolve tag | |
| id: tag | |
| env: | |
| TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| run: | | |
| if [[ -z "$TAG" ]]; then | |
| echo "::error::No tag provided" | |
| exit 1 | |
| fi | |
| if [[ ! "$TAG" =~ ^schema/v?[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then | |
| echo "::error::Tag '$TAG' does not match expected pattern schema/vX.Y.Z" | |
| exit 1 | |
| fi | |
| RAW_VERSION="${TAG#schema/}" | |
| VERSION="${RAW_VERSION#v}" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ steps.tag.outputs.tag }} | |
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| - name: Sync canonical schemas into the package | |
| run: make sync-schema | |
| - name: Set package version | |
| working-directory: schema/python | |
| run: sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml | |
| env: | |
| VERSION: ${{ steps.tag.outputs.version }} | |
| - name: Build package | |
| working-directory: schema/python | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | |
| with: | |
| packages-dir: schema/python/dist/ |