Skip to content

other

other #19

Workflow file for this run

name: Publish
on:
push:
tags:
- '*'
release:
types:
- published
permissions:
contents: read
id-token: write
env:
FORCE_COLOR: "1"
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
jobs:
# Always build & lint package.
build-package:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
github-release:
name: Make a GitHub Release
needs: [build-package]
# only publish a Github release on push tag
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
# IMPORTANT: mandatory for making GitHub Releases
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.event.inputs.version }}
generate_release_notes: true
draft: true
publish-to-pypi:
name: Publish package to pypi.
needs: [build-package]
environment:
name: pypi
url: https://pypi.org/p/subliminal
permissions:
id-token: write
runs-on: ubuntu-latest
# only publish to PyPI on Github release published
if: |
github.repository == 'Diaoul/subliminal'
&& github.event_name == 'release'
&& github.event.action == 'published'
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}