prep stapi-fastapi release v0.7.0 (#96) #1
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: | |
| push: | |
| tags: | |
| - "*/v*" | |
| jobs: | |
| package_name: | |
| name: Get package name | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package_name: ${{ steps.split.outputs.package_name }} | |
| steps: | |
| - name: Get repo name | |
| # https://stackoverflow.com/questions/73402042/github-action-expressions-split-string | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| id: split | |
| run: echo "package_name=${TAG%%/*}" >> $GITHUB_OUTPUT | |
| release: | |
| name: Release ${{ needs.package_name.outputs.package_name }} | |
| runs-on: ubuntu-latest | |
| needs: package_name | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/${{ needs.package_name.outputs.package_name }} | |
| permissions: | |
| id-token: write | |
| if: ${{ github.repository }} == 'stapi-spec/pystapi' | |
| defaults: | |
| run: | |
| working-directory: ${{ needs.package_name.outputs.package_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Create virtual environment | |
| run: uv venv | |
| - name: Install build | |
| run: uv pip install build | |
| - name: Build | |
| run: .venv/bin/python -m build | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: ${{ needs.package_name.outputs.package_name}}/dist | |
| docker: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| needs: package_name | |
| if: ${{ needs.package_name.outputs.package_name }} == 'stapi-fastapi' | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Log in to the Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: stapi-spec/stapi-fastapi:${{ github.ref_name }} | |
| build-args: PYTHON_VERSION='3.12' |