-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (81 loc) · 2.49 KB
/
build-publish-sign-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: build-publish-sign-release
on:
push:
tags:
- '*'
jobs:
call-workflow-lint-test-cover-docs:
name: Call linting/testing workflow.
uses: ./.github/workflows/lint-test-cover-docs.yml
secrets: inherit
build:
name: Build package.
needs:
- call-workflow-lint-test-cover-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python.
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
- name: Install pypa/build.
run: python -m pip install .[publish]
- name: Build a source tarball and a binary wheel.
run: python -m build --sdist --wheel .
- name: Store the package distributions.
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish package to PyPI.
if: startsWith(github.ref, 'refs/tags/') # Publish on tag pushes.
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/egcd
permissions:
id-token: write
steps:
- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
sign-release:
name: Sign package distributions with Sigstore and upload them to a GitHub release.
needs:
- publish
runs-on: ubuntu-latest
permissions:
contents: write # For GitHub.
id-token: write # For Sigstore.
steps:
- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the package distributions with Sigstore.
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create a GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}'
- name: Upload package distributions and signatures/certificates to the GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'