Skip to content

Commit

Permalink
Merge pull request #113 from livechat/separate-pypi-and-testpypi-publ…
Browse files Browse the repository at this point in the history
…ish-workflows

Separate PyPI and TestPyPI publish workflows
  • Loading branch information
skamieniarz authored Sep 28, 2023
2 parents ee96b8c + 4649b47 commit 75b770a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 30 deletions.
33 changes: 3 additions & 30 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Publish Python distribution
name: Publish Python distribution to PyPI

on:
push:
branches:
- master
release:
types: [published]

jobs:
build:
Expand Down Expand Up @@ -32,7 +31,6 @@ jobs:

publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -50,28 +48,3 @@ jobs:
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

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

environment:
name: testpypi
url: https://test.pypi.org/p/lc-sdk-python

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

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
56 changes: 56 additions & 0 deletions .github/workflows/publish-to-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Python distribution to TestPyPI

on:
push:
branches:
- master

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

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

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

environment:
name: testpypi
url: https://test.pypi.org/p/lc-sdk-python

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

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

0 comments on commit 75b770a

Please sign in to comment.