Skip to content

Commit 7a335eb

Browse files
ci: replace publish workflow (#121)
* Fix publish workflow * Replace publish workflow with official pypa action * fix copypasta * Re-add fetch-depth
1 parent 3ee059c commit 7a335eb

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

.github/workflows/publish.yml

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,54 @@
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-python-client-${{ 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
1618
with:
1719
fetch-depth: 0
1820

19-
- name: Build and publish to pypi
20-
uses: JRubics/[email protected]
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.12
24+
25+
- name: Install Poetry
26+
run: pipx install poetry
27+
28+
- name: Build Package
29+
run: poetry build
30+
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: ${{ env.artifact-name }}
34+
path: dist/
35+
36+
- uses: softprops/action-gh-release@v2
2137
with:
22-
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
23-
ignore_dev_requirements: 'yes'
24-
build_format: 'sdist'
38+
tag_name: ${{ env.tag_name }}
39+
files: dist/*
40+
41+
publish:
42+
runs-on: ubuntu-latest
43+
needs: build
44+
45+
permissions:
46+
id-token: write # for pypa/gh-action-pypi-publish to authenticate with PyPI
47+
48+
steps:
49+
- uses: actions/download-artifact@v4
50+
with:
51+
name: ${{ env.artifact-name }}
52+
path: dist/
53+
54+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)