This file contains 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: Publish to PyPI and GHCR | ||
on: | ||
push: | ||
tags: | ||
- test-v* | ||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: 'https://pypi.org/p/pypi-browser-webapp' | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.13' | ||
- name: Install dependencies | ||
run: pip install build | ||
- name: Build Python artifacts | ||
run: python -m build --sdist --wheel --outdir dist | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
skip-existing: true | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Retrieve wheel name | ||
id: wheel | ||
run echo "WHEEL=$(ls dist/*.whl)" >> $GITHUB_OUTPUT | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
build-args: | ||
- WHEEL=${{ steps.wheel.outputs.WHEEL }} | ||
tags: | ||
- 'ghcr.io/chriskuehl/pypi-browser:latest' | ||
- 'ghcr.io/chriskuehl/pypi-browser:${{ github.ref_name }}' | ||
push: true |