fix(release): lowercase GHCR owner so docker push works #3
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 | |
| # Triggered by pushing a tag matching v*. Builds the Python wheel + sdist | |
| # and publishes to PyPI, and builds the Docker image and pushes to GHCR | |
| # under the same version tag. | |
| # | |
| # Required repository secrets (configure in Settings → Secrets): | |
| # PYPI_API_TOKEN — PyPI project-scoped token (https://pypi.org/manage/account/token/) | |
| # Required permissions: | |
| # contents: read | |
| # packages: write (for ghcr.io) | |
| # (The GITHUB_TOKEN is auto-provided.) | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| pypi: | |
| name: build + publish to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build wheel + sdist | |
| run: python -m build | |
| - name: Twine check | |
| run: twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| if [ -z "$TWINE_PASSWORD" ]; then | |
| echo "PYPI_API_TOKEN not set — skipping publish (artifact built only)." | |
| exit 0 | |
| fi | |
| twine upload dist/* | |
| docker: | |
| name: build + push docker image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag + lowercase owner | |
| id: ver | |
| run: | | |
| echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| # GHCR requires lowercase repo paths; the github actor / owner | |
| # may contain capitals. | |
| echo "owner_lc=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build + push (multi-arch) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.ver.outputs.owner_lc }}/zhub:latest | |
| ghcr.io/${{ steps.ver.outputs.owner_lc }}/zhub:${{ steps.ver.outputs.version }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |