Skip to content

Commit

Permalink
add pypi and testpypi release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Jan 30, 2024
1 parent 3d2abe8 commit bc21784
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: TestPyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+'

jobs:

build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
name: pypi-artifacts
path: dist/*.tar.gz

show-artifacts:
needs: ["build-sdist"]
name: "Show artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist

- shell: bash
run: |
ls -l ${{ github.workspace }}/dist
publish-to-test-pypi:
needs: ["build-sdist"]
name: "Publish to TestPyPI"
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v3
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: 'https://test.pypi.org/legacy/'
skip_existing: true
print_hash: true
verify_metadata: false
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '!v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+'


jobs:

build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
name: pypi-artifacts
path: dist/*.tar.gz

show-artifacts:
needs: ["build-sdist"]
name: "Show artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist

- shell: bash
run: |
ls -l ${{ github.workspace }}/dist
publish-to-test-pypi:
needs: ["build-sdist"]
name: "Publish to PyPI"
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v3
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
print_hash: true
verify_metadata: false

0 comments on commit bc21784

Please sign in to comment.