backport release workflow from main branch · python-poetry/poetry@8d2a341 (original) (raw)

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
1 +name: Release
2 +
3 +on:
4 +release:
5 +types: [published]
6 +
7 +jobs:
8 +build:
9 +name: Build
10 +runs-on: ubuntu-latest
11 +steps:
12 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
13 +
14 + - run: pipx run build
15 +
16 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
17 +with:
18 +name: distfiles
19 +path: dist/
20 +if-no-files-found: error
21 +
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
31 +
32 + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
33 +with:
34 +name: distfiles
35 +path: dist/
36 +
37 + - run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
38 +env:
39 +GH_TOKEN: ${{ github.token }}
40 +
41 +upload-pypi:
42 +name: Upload (PyPI)
43 +runs-on: ubuntu-latest
44 +environment:
45 +name: pypi
46 +url: https://pypi.org/project/poetry/
47 +permissions:
48 +id-token: write
49 +needs: build
50 +steps:
51 + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
52 +with:
53 +name: distfiles
54 +path: dist/
55 +
56 + - uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
57 +with:
58 +print-hash: true