Skip to content

Commit

Permalink
Publish release workflow (#37)
Browse files Browse the repository at this point in the history
* add python package release workflow

* add test release workflow
  • Loading branch information
alexdej authored Jun 13, 2024
1 parent 792463f commit b756499
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ jobs:
runs-on: ubuntu-latest
needs:
- build

environment:
name: pypi
url: https://pypi.org/puzpy
url: https://pypi.org/p/puzpy

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download dist package
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1

54 changes: 54 additions & 0 deletions .github/workflows/python-test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow builds the python dist and uploads to test pypi in response to a release being created
# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

name: publish release

on:
release:
types: [ created ]

jobs:
build:
name: Build dist package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install build
run: pip install build
- name: Build binary wheel and a source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/


publish-to-testpypi:
name: Publish Python distribution to TestPyPI
runs-on: ubuntu-latest
needs:
- build

environment:
name: testpypi
url: https://test.pypi.org/p/puzpy

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download dist package
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit b756499

Please sign in to comment.