-
Notifications
You must be signed in to change notification settings - Fork 4
200 lines (175 loc) · 7.43 KB
/
release-please.yml
File metadata and controls
200 lines (175 loc) · 7.43 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# This workflow handles both automated and manual package publishing:
#
# AUTOMATED PUBLISHING (on push to main):
# - Triggered automatically when changes are pushed to the main branch
# - Uses release-please to create releases based on conventional commits
# - Publishes packages to PyPI automatically when release PRs are merged
#
# MANUAL PUBLISHING (via workflow_dispatch):
# - Can be triggered manually from the Actions tab
# - Allows publishing a specific package to PyPI
# - Supports dry-run mode
#
name: release-please
on:
push:
branches:
- main
workflow_dispatch:
inputs:
workspace_path:
description: 'The workspace to publish'
required: true
default: 'packages/sdk/server-ai'
type: choice
options:
- packages/sdk/server-ai
- packages/ai-providers/server-ai-langchain
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for release-please to create releases.
pull-requests: write # Needed for release-please to create/update PRs.
if: github.event_name == 'push'
outputs:
package-server-ai-released: ${{ steps.release.outputs['packages/sdk/server-ai--release_created'] }}
package-server-ai-tag-name: ${{ steps.release.outputs['packages/sdk/server-ai--tag_name'] }}
package-server-ai-langchain-released: ${{ steps.release.outputs['packages/ai-providers/server-ai-langchain--release_created'] }}
package-server-ai-langchain-tag-name: ${{ steps.release.outputs['packages/ai-providers/server-ai-langchain--tag_name'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
release-server-ai:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
if: ${{ needs.release-please.outputs.package-server-ai-released == 'true' }}
outputs:
package-hashes: ${{ steps.build.outputs.package-hashes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
- uses: ./.github/actions/ci
with:
workspace_path: packages/sdk/server-ai
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/sdk/server-ai
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/sdk/server-ai/dist/
release-server-ai-langchain:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
if: ${{ needs.release-please.outputs.package-server-ai-langchain-released == 'true' }}
outputs:
package-hashes: ${{ steps.build.outputs.package-hashes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-langchain
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/ai-providers/server-ai-langchain
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
# Pin the action to a full 40-character commit SHA for security.
# Release v1 commit SHA as of 2024-06-14:
# https://github.com/pypa/gh-action-pypi-publish/releases/tag/v1.8.13
# Commit SHA: 19af04270e8d898ea07a523bb392fa7fe98df87c
uses: pypa/gh-action-pypi-publish@19af04270e8d898ea07a523bb392fa7fe98df87c
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/ai-providers/server-ai-langchain/dist/
manual-publish:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
contents: read # Needed for actions/checkout.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install poetry
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
- uses: ./.github/actions/ci
with:
workspace_path: ${{ inputs.workspace_path }}
- uses: ./.github/actions/build
id: build
with:
workspace_path: ${{ inputs.workspace_path }}
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
if: ${{ inputs.dry_run != true }}
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
if: ${{ inputs.dry_run != true }}
# https://github.com/pypa/gh-action-pypi-publish/releases/tag/v1.8.13 - pinned to commit on 2024-04-13
uses: pypa/gh-action-pypi-publish@3cc2c35166dfc1e5ea3bb0491ffdeedcaa50d7c
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: ${{ inputs.workspace_path }}/dist/
release-server-ai-provenance:
needs: ['release-please', 'release-server-ai']
if: ${{ needs.release-please.outputs.package-server-ai-released == 'true' }}
permissions:
actions: read # Needed for detecting the GitHub Actions environment.
id-token: write # Needed for provenance signing.
contents: write # Needed for uploading assets to the release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.release-server-ai.outputs.package-hashes }}"
upload-assets: true
upload-tag-name: ${{ needs.release-please.outputs.package-server-ai-tag-name }}
release-server-ai-langchain-provenance:
needs: ['release-please', 'release-server-ai-langchain']
if: ${{ needs.release-please.outputs.package-server-ai-langchain-released == 'true' }}
permissions:
actions: read # Needed for detecting the GitHub Actions environment.
id-token: write # Needed for provenance signing.
contents: write # Needed for uploading assets to the release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.release-server-ai-langchain.outputs.package-hashes }}"
upload-assets: true
upload-tag-name: ${{ needs.release-please.outputs.package-server-ai-langchain-tag-name }}