Skip to content

automate writing correct tag to pyproject.toml using workflow #9

automate writing correct tag to pyproject.toml using workflow

automate writing correct tag to pyproject.toml using workflow #9

Workflow file for this run

name: Upload release to PyPI
on:
push:
tags:
- '*'
jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pong-arcade/
permissions:
id-token: write
steps:
- uses: actions/checkout@master
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install build
run: >-
pip install build
- name: Extract tag name
id: tag
run: echo "TAG_NAME={$(echo $GITHUB_REF | cut -d / -f 3)}" >> $GITHUB_OUTPUT
- name: Update version in pyproject.toml
run: >-
sed -i 's/{{VERSION_PLACEHOLDER}}/$TAG_NAME/g' pyproject.toml
- name: Build a binary wheel
run: >-
python3 -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1