Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 43 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
name: Publish PyPI Package
name: Publish to PyPI

on:
push:
tags:
- '*'
release:
types: [published]
workflow_dispatch:

env:
tag_name: ${{ github.event.release.tag_name || github.ref_name }}
artifact-name: flagsmith-python-client-${{ github.event.release.tag_name || github.ref_name }}

jobs:
package:
build:
runs-on: ubuntu-latest
name: Publish Pypi Package

steps:
- name: Cloning repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.10
- uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install Poetry
run: pipx install poetry

- name: Build Package
run: poetry build

- uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact-name }}
path: dist/

- uses: softprops/action-gh-release@v2
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
ignore_dev_requirements: 'yes'
build_format: 'sdist'
tag_name: ${{ env.tag_name }}
files: dist/*

publish:
runs-on: ubuntu-latest
needs: build

permissions:
id-token: write # for pypa/gh-action-pypi-publish to authenticate with PyPI

steps:
- uses: actions/download-artifact@v4
with:
name: ${{ env.artifact-name }}
path: dist/

- uses: pypa/gh-action-pypi-publish@release/v1