Skip to content

Commit e246eab

Browse files
committed
updated workflow to publish on new tag
1 parent 8d25ab8 commit e246eab

File tree

2 files changed

+99
-17
lines changed

2 files changed

+99
-17
lines changed

.github/workflows/python-publish.yml

Lines changed: 98 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,109 @@ on:
88
types: [created]
99

1010
jobs:
11-
deploy:
11+
build:
12+
name: build-dist
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: setup-python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.x"
21+
- name: install-pypa/build
22+
run: >-
23+
python3 -m
24+
pip install
25+
build
26+
--user
27+
- name: build-bin-whl
28+
run: python3 -m build
29+
- name: grab-build
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: pkg-dist
33+
path: dist/
34+
35+
publish-to-pypi:
36+
name: >-
37+
publish-to-pypi
38+
if: startsWith(github.ref, 'refs/tags/')
39+
needs:
40+
- build
41+
runs-on: ubuntu-latest
42+
environment:
43+
name: production
44+
url: https://pypi.org/p/empiarreader
45+
permissions:
46+
id-token: write
47+
48+
steps:
49+
- name: download-dists
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: pkg-dist
53+
path: dist/
54+
- name: publish-dist-to-pypi
55+
uses: pypa/gh-action-pypi-publish@release/v1
1256

57+
github-release:
58+
name: >-
59+
sign-dist-via-sigstore-and-upload-to-github-release
60+
needs:
61+
- publish-to-pypi
1362
runs-on: ubuntu-latest
1463

15-
environment: deployment
64+
permissions:
65+
contents: write
66+
id-token: write
1667

1768
steps:
18-
- uses: actions/checkout@v2
69+
- name: download-dists
70+
uses: actions/download-artifact@v3
1971
with:
20-
submodules: recursive
21-
- name: Set up Python
22-
uses: actions/setup-python@v2
72+
name: pkg-dist
73+
path: dist/
74+
- name: sign-dists
75+
uses: sigstore/gh-action-sigstore-python@v1.2.3
2376
with:
24-
python-version: '3.x'
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install setuptools wheel twine
29-
- name: Build and publish
77+
inputs: >-
78+
./dist/*.tar.gz
79+
./dist/*.whl
80+
- name: create-github-release
81+
env:
82+
GITHUB_TOKEN: ${{ github.token }}
83+
run: >-
84+
gh release create
85+
'${{ github.ref_name }}'
86+
--repo '${{ github.repository }}'
87+
--notes ""
88+
- name: upload-artifact-signature-to-github-release
3089
env:
31-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
32-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
33-
run: |
34-
python setup.py sdist
35-
twine upload dist/*
90+
GITHUB_TOKEN: ${{ github.token }}
91+
run: >-
92+
gh release upload
93+
'${{ github.ref_name }}' dist/**
94+
--repo '${{ github.repository }}'
95+
96+
# publish-to-test-pypi:
97+
# name: publish-to-test-pypi
98+
# if: startsWith(github.ref, 'refs/heads/development')
99+
# needs:
100+
# - build
101+
# runs-on: ubuntu-latest
102+
# environment:
103+
# name: testing
104+
# url: https://test.pypi.org/p/empiarreader
105+
# permissions:
106+
# id-token: write
107+
# steps:
108+
# - name: download-dists
109+
# uses: actions/download-artifact@v3
110+
# with:
111+
# name: pkg-dist
112+
# path: dist/
113+
# - name: publish-dist-to-test-pypi
114+
# uses: pypa/gh-action-pypi-publish@release/v1
115+
# with:
116+
# repository-url: https://test.pypi.org/legacy/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*/__pycache__
22
*/*/__pycache__
33
*/*/*/__pycache__
4+
tmp.txt

0 commit comments

Comments
 (0)