Release #7
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
--- | |
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
target: | |
default: testpypi | |
description: Deployment target. Can be pypi or testpypi. | |
release: | |
types: | |
- published | |
jobs: | |
dist: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Replace stable version with the release version | |
run: |- | |
# store the release tag | |
tag="${{ github.ref_name }}" | |
# regex patterns | |
badge_pattern="s#(readthedocs\.org/projects/glass/badge/\?version=)stable#\1${tag}#g" | |
url_pattern="s#(glass\.readthedocs\.io.*?)/stable#\1/${tag}#g" | |
# perform the replacements | |
sed --in-place --regexp-extended \ | |
--expression "$badge_pattern" \ | |
--expression "$url_pattern" \ | |
${{ github.workspace }}/README.md | |
- name: Build SDist and wheel | |
run: pipx run build | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist/* | |
publish: | |
needs: dist | |
runs-on: ubuntu-latest | |
environment: | |
name: publish | |
url: https://pypi.org/p/glass | |
permissions: | |
id-token: write | |
steps: | |
- name: Download distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- name: List distributions to be deployed | |
run: ls -l dist/ | |
- name: Publish to PyPI | |
if: >- | |
github.event.inputs.target == 'pypi' || (github.event_name == | |
'release' && github.event.action == 'published') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Publish to TestPyPI | |
if: github.event.inputs.target == 'testpypi' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |