Workflow file for this run
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
# https://docs.pypi.org/trusted-publishers/using-a-publisher/#github-actions | |
name: Publish release to PyPI (or Test.PyPI) | |
on: | |
release: | |
types: [prereleased, released] | |
permissions: | |
contents: read | |
jobs: | |
release-build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/prepare-deps | |
- name: Build release distributions | |
run: | | |
uvx flit build --no-use-vcs | |
- name: Verify version and tags | |
run: | | |
filever=$(ls dist | sed -nr 's/apple_hdr_heic-(.*)\.tar\.gz/\1/p') | |
tagver=$(echo '${{ github.ref }}' | sed -r 's#refs/tags/v(.*)#\1#') | |
echo "filever=$filever" "tagver=$tagver" | |
test "$filever" = "$tagver" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
test-pypi-publish: | |
runs-on: ubuntu-24.04 | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- release-build | |
permissions: | |
id-token: write # IMPORTANT: this is mandatory for trusted publishing | |
environment: | |
name: test-publish | |
url: https://test.pypi.org/p/apple-hdr-heic | |
steps: | |
- name: Retrieve build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish release distributions to Test.PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
pypi-publish: | |
runs-on: ubuntu-24.04 | |
if: startsWith(github.ref, 'refs/tags/v') && github.event.action == 'released' | |
needs: | |
- release-build | |
- test-pypi-publish | |
permissions: | |
id-token: write | |
environment: | |
name: pypi-publish | |
url: https://pypi.org/p/apple-hdr-heic | |
steps: | |
- name: Retrieve build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |