Skip to content

Build and publish to PyPI and GHCR #35

Build and publish to PyPI and GHCR

Build and publish to PyPI and GHCR #35

Workflow file for this run

name: Build and publish to PyPI and GHCR
on:
workflow_dispatch:
release:
types: [created]
env:
REGISTRY: ghcr.io
IMAGE_NAME: "${{ github.repository_owner }}/reqstool"
permissions:
contents: read
jobs:
check-release:
name: Reuse check release
uses: ./.github/workflows/check_release.yml
build:
name: Reuse build
uses: ./.github/workflows/build.yml
publish-to-pypi:
needs:
- check-release
- build
runs-on: ubuntu-latest
environment:
name: prod
url: https://pypi.org/p/reqstool
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# Download artifacts from the build job
- name: Download Artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
sign-artifacts: true
skip-existing: true
publish-image-to-ghcr:
if: github.event_name == 'release'
needs:
- publish-to-pypi
permissions:
contents: read
packages: write
id-token: write
uses: ./.github/workflows/publish-image.yml
with:
version: ${{ github.event.release.tag_name }}