-
Notifications
You must be signed in to change notification settings - Fork 15
89 lines (83 loc) · 2.86 KB
/
publish-a-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
82
83
84
85
86
87
88
89
name: Publish a wakepy release 📦
# This workflow creates and pushes releases to PyPI and to GitHub Releases.
# It can only be started manually.
# NOTE: Before making a release, push a new tag to main branch. This workflow
# uses the latest tag for setting the wakepy release version number.
'on':
workflow_dispatch:
jobs:
build-and-test:
if: startsWith(github.ref, 'refs/tags/v')
uses: ./.github/workflows/build-and-run-tests.yml
sign-artifacts:
name: Sign artifacts ✍️🔒
needs: build-and-test
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC. See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
steps:
- uses: actions/download-artifact@v4
with:
name: wakepy-python-packages
path: ./dist/
- uses: sigstore/gh-action-sigstore-python@61f6a500bbfdd9a2a339cf033e5421951fbc1cd2 #v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: signed-wakepy-python-packages
path: ./dist/*.*
if-no-files-found: error
retention-days: 1
publish-to-pypi:
name: 📦 Publish wakepy to PyPI
needs: build-and-test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/wakepy
permissions:
id-token: write # mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
name: wakepy-python-packages
path: ./dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 #v1.8.14
with:
print-hash: true
publish-to-github-releases:
name: 📦 Publish wakepy to GitHub
needs: sign-artifacts
runs-on: ubuntu-latest
environment:
name: github-release
steps:
- uses: actions/download-artifact@v4
with:
name: signed-wakepy-python-packages
path: ./dist/
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
VERSION="${{github.ref_name}}" &&
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--title "wakepy ${VERSION:1}"
--notes ""
--draft
- name: Publish distribution & signatures 📦 to GitHub Releases
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'