Skip to content
Merged
Changes from 2 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: 42 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
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-common-${{ github.event.release.tag_name || github.ref_name }}
Comment thread
khvn26 marked this conversation as resolved.
Outdated

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

steps:
- name: Cloning repo
uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
fetch-depth: 0
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

python-version: 3.12

- name: Install Poetry
run: pipx install poetry

- name: Build Package
run: poetry build

- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.10
- uses: actions/upload-artifact@v4
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
ignore_dev_requirements: 'yes'
build_format: 'sdist'
name: ${{ env.artifact-name }}
path: dist/

- uses: softprops/action-gh-release@v2
with:
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