Skip to content

Commit 3f2d595

Browse files
committed
Replace publish workflow with official pypa action
1 parent aad87e2 commit 3f2d595

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed

.github/workflows/publish.yml

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,52 @@
1-
name: Publish PyPI Package
1+
name: Publish to PyPI
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
env:
9+
tag_name: ${{ github.event.release.tag_name || github.ref_name }}
10+
artifact-name: flagsmith-common-${{ github.event.release.tag_name || github.ref_name }}
711

812
jobs:
9-
package:
13+
build:
1014
runs-on: ubuntu-latest
11-
name: Publish Pypi Package
1215

1316
steps:
14-
- name: Cloning repo
15-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v4
1620
with:
17-
fetch-depth: 0
21+
python-version: 3.12
22+
23+
- name: Install Poetry
24+
run: pipx install poetry
25+
26+
- name: Build Package
27+
run: poetry build
1828

19-
- name: Build and publish to pypi
20-
uses: JRubics/poetry-publish@v2
29+
- uses: actions/upload-artifact@v4
2130
with:
22-
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
23-
build_format: 'sdist'
24-
poetry_install_options: '--without dev'
31+
name: ${{ env.artifact-name }}
32+
path: dist/
33+
34+
- uses: softprops/action-gh-release@v2
35+
with:
36+
tag_name: ${{ env.tag_name }}
37+
files: dist/*
38+
39+
publish:
40+
runs-on: ubuntu-latest
41+
needs: build
42+
43+
permissions:
44+
id-token: write # for pypa/gh-action-pypi-publish to authenticate with PyPI
45+
46+
steps:
47+
- uses: actions/download-artifact@v4
48+
with:
49+
name: ${{ env.artifact-name }}
50+
path: dist/
51+
52+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)