-
Notifications
You must be signed in to change notification settings - Fork 243
90 lines (79 loc) · 2.92 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (79 loc) · 2.92 KB
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
90
name: Release
on:
push:
branches:
- main
release:
types: [published]
env:
LATEST_PY_VERSION: '3.14'
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
contents: write # Needed for release-please to create PRs
pull-requests: write # Needed for release-please to create PRs
steps:
# Mint a GitHub App token so the release-please-created release is authored by the
# App, not github-actions[bot]. Events from the default GITHUB_TOKEN do NOT trigger
# new workflow runs (GitHub anti-recursion), which is why bot-created releases never
# fired `release: published` and the build/upload_pypi/deploy jobs below were skipped.
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
app-id: ${{ secrets.DS_RELEASE_BOT_ID }}
private-key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}
# Scope the minted token to least privilege instead of inheriting the App's
# blanket installation permissions (zizmor: dangerous-github-app-tokens).
# release-please only needs Contents (tags/release) + Pull requests (release PR).
permission-contents: write
permission-pull-requests: write
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ steps.app-token.outputs.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
build:
name: Build dist
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.9.*"
enable-cache: false
python-version: ${{ env.LATEST_PY_VERSION }}
- name: Install dependencies
run: |
uv sync
- name: Build
run: |
scripts/build
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
path: ./dist/
upload_pypi:
name: Upload release to PyPI
needs: [build]
runs-on: ubuntu-latest
environment:
name: pypi-release
permissions:
contents: read
id-token: write # OIDC token for PyPI trusted publishing (pypa/gh-action-pypi-publish)
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: artifact
path: dist
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0