Skip to content

Publish to test PyPI #5

Publish to test PyPI

Publish to test PyPI #5

Workflow file for this run

---
name: Build & publish
on: [push]
jobs:
build:
name: Build wheel
# only build on tag pushes
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install hatch
run: python3 -m pip install hatch --user
- name: Build
run: hatch build -t wheel
- name: Save wheel as artifact
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Create GitHub release & publish to PyPI
# only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rocketgate
permissions:
id-token: write
steps:
- name: Environment
run: echo "RELEASE_VERSION=$(git describe --tags)" > $GITHUB_ENV
- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
body: ${{ github.event.workflow_run.head_commit.message }}
files: dist/rocketgate-${{ env.RELEASE_VERSION }}.whl
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/