Skip to content

Commit

Permalink
Workflow for pypi auto-publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
JatGreer committed Dec 4, 2023
1 parent 5c26a77 commit 9e22ef4
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: publish-roodmus-to-pypi

on: push

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

steps:
- uses: actions/checkout@v4
- name: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10.4"
- name: install-pypa/build
run: >-
python3 -m
pip install
build
--user
- name: build-bin-whl
run: python3 -m build
- name: grab-build
uses: actions/upload-artifact@v3
with:
name: pkg-dist
path: dist/

publish-to-pypi:
name: >-
publish-to-pypi
if: startsWith(github.ref, 'ref/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: production
url: https://pypi.org/p/roodmus
permissions:
-id-token: write

steps:
- name: download-dists
uses: actions/download-artifact@v3
with:
name: pkg-dist
path: dist/
- name: publish-dist-to-pypi
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
sign-dist-via-sigstore-and-upload-to-github-release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
- name: download-dists
uses: actions/download-artifact@v3
with:
name: pkg-dist
path: dist/
- name: sign-dists
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: create-github-release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: upload-artifact-signature-to-github-release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-test-pypi:
name: publish-to-test-pypi
if: startsWith('ref/head/main', 'ref/head/development', 'ref/tags/')
needs:
- build
runs-on: ubuntu-latest

environment:
name: testing
url: https://test.pypi/org/p/roodmus

permissions:
id-token: write

steps:
- name: download-dists
uses: actions/download-artifact@v3
with:
name: pkg-dist
path: dist/
- name: publish-dist-to-test-pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/

0 comments on commit 9e22ef4

Please sign in to comment.