fix(ci): update stale actions in python publish script #33
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
# To create a release: | |
# - commit the changes | |
# - create an annotated tag with the version number, e.g.: git tag -a v2.0.1 -m "v2.0.1" | |
# - push the tag, which will trigger this pythonpublish release workflow and hatch build will build and publish using the tag version | |
# - note: only builds from tagged commits will have proper release versions, others will have dev versions | |
name: Publish g2p to PyPI and create a GitHub release | |
on: | |
push: | |
tags: | |
- v[0-9]+.** | |
jobs: | |
tests: | |
uses: ./.github/workflows/tests.yml | |
secrets: inherit | |
matrix-tests: | |
uses: ./.github/workflows/matrix-tests.yml | |
secrets: inherit | |
build: | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install build tool | |
run: pip install build | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
github-release: | |
name: Make a signed GitHub release | |
needs: | |
- tests | |
- matrix-tests | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Sign the dists with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Update CHANGELOG | |
id: changelog | |
uses: requarks/changelog-action@v1 | |
with: | |
token: ${{ github.token }} | |
tag: ${{ github.ref_name }} | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
allowUpdates: true | |
name: ${{ github.ref_name }} | |
tag: ${{ github.ref_name }} | |
body: ${{ steps.changelog.outputs.changes }} | |
token: ${{ github.token }} | |
deploy-docs: | |
runs-on: ubuntu-latest | |
needs: | |
- github-release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all commits/branches | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[docs] | |
- name: Setup doc deploy | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Deploy docs with mike 🚀 | |
run: | | |
mike deploy --push --update-aliases ${{ github.ref_name }} stable latest | |
publish-to-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: | |
- github-release | |
- deploy-docs | |
environment: | |
name: pypi | |
url: https://pypi.org/p/g2p | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download the distribution packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
# Convertextract depends on g2p<2.0, maybe this is no longer relevant? | |
# Or do we want to keep it because eventually convertextract will depend on g2p>=2.0? | |
trigger-convertextract-build: | |
runs-on: ubuntu-latest | |
needs: publish-to-pypi | |
steps: | |
- name: trigger convertextract build | |
run: | | |
curl --location --request POST 'https://api.github.com/repos/roedoejet/convertextract/dispatches' \ | |
--header 'Accept: application/vnd.github.everest-preview+json' \ | |
--header 'Content-Type: application/json' \ | |
--header 'Authorization: Bearer ${{ secrets.G2P_PAT }}' \ | |
--header 'Content-Type: text/plain' \ | |
--data-raw '{ | |
"event_type": "g2p-published", | |
"client_payload": {} | |
}' |