Skip to content

Commit 28b5e53

Browse files
committed
Update release workflow
1 parent 06b4dd8 commit 28b5e53

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- '*.*.*'
4+
release:
5+
types: [published]
76

87
jobs:
9-
release:
10-
name: Release
8+
build:
9+
name: Build
1110
runs-on: ubuntu-latest
1211
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
12+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
1513

16-
- name: Set up Python 3.9
17-
uses: actions/setup-python@v4
18-
with:
19-
python-version: "3.9"
14+
- run: pipx run build
2015

21-
- name: Install Poetry
22-
run: |
23-
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }}
16+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
17+
with:
18+
name: distfiles
19+
path: dist/
20+
if-no-files-found: error
2421

25-
- name: Update PATH
26-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
22+
upload-github:
23+
name: Upload (GitHub)
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
needs: build
28+
steps:
29+
# We need to be in a git repo for gh to work.
30+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
2731

28-
- name: Build project for distribution
29-
run: poetry build
32+
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
33+
with:
34+
name: distfiles
35+
path: dist/
3036

31-
- name: Check Version
32-
id: check-version
33-
run: |
34-
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
35-
|| echo "prerelease=true" >> $GITHUB_OUTPUT
37+
- run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
38+
env:
39+
GH_TOKEN: ${{ github.token }}
3640

37-
- name: Create Release
38-
uses: ncipollo/release-action@v1
41+
upload-pypi:
42+
name: Upload (PyPI)
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/project/poetry-plugin-shell/
47+
permissions:
48+
id-token: write
49+
needs: build
50+
steps:
51+
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
3952
with:
40-
artifacts: "dist/*"
41-
token: ${{ secrets.GITHUB_TOKEN }}
42-
draft: false
43-
prerelease: steps.check-version.outputs.prerelease == 'true'
53+
name: distfiles
54+
path: dist/
4455

45-
- name: Publish to PyPI
46-
env:
47-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
48-
run: poetry publish
56+
- uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
57+
with:
58+
print-hash: true

0 commit comments

Comments
 (0)