Skip to content

Commit 29b9e11

Browse files
authored
ci(release): push releases with a short-lived GitHub App token (#2041)
1 parent d2222a5 commit 29b9e11

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
default: ""
3434

3535
permissions:
36-
contents: write
36+
contents: read
3737
id-token: write # Required for PyPI Trusted Publishing via OIDC
3838

3939
concurrency:
@@ -93,7 +93,6 @@ jobs:
9393
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
9494
with:
9595
fetch-depth: 0
96-
token: ${{ secrets.GH_ACCESS_TOKEN }}
9796
persist-credentials: false
9897

9998
- name: Install uv and set Python version
@@ -104,15 +103,10 @@ jobs:
104103
enable-cache: false
105104

106105
- name: Configure Git
107-
env:
108-
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
109106
run: |
110107
git config user.name "langfuse-bot"
111108
git config user.email "langfuse-bot@langfuse.com"
112109
113-
echo "$GH_ACCESS_TOKEN" | gh auth login --with-token
114-
gh auth setup-git
115-
116110
- name: Get current version
117111
id: current-version
118112
run: |
@@ -316,13 +310,23 @@ jobs:
316310
env:
317311
STEPS_NEW_VERSION_OUTPUTS_VERSION: ${{ steps.new-version.outputs.version }}
318312

313+
- name: Create release GitHub App token
314+
id: release-token
315+
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
316+
with:
317+
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
318+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
319+
permission-contents: write
320+
319321
- name: Create and push tag
320322
id: push-tag
321323
run: |
324+
gh auth setup-git
322325
git tag "v${STEPS_NEW_VERSION_OUTPUTS_VERSION}"
323326
git push origin "HEAD:${GITHUB_REF_NAME}"
324327
git push origin "v${STEPS_NEW_VERSION_OUTPUTS_VERSION}"
325328
env:
329+
GH_TOKEN: ${{ steps.release-token.outputs.token }}
326330
STEPS_NEW_VERSION_OUTPUTS_VERSION: ${{ steps.new-version.outputs.version }}
327331

328332
- name: Publish to PyPI
@@ -341,7 +345,7 @@ jobs:
341345
$prerelease_flag \
342346
dist/*.whl dist/*.tar.gz
343347
env:
344-
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
348+
GH_TOKEN: ${{ steps.release-token.outputs.token }}
345349
VERSION: ${{ steps.new-version.outputs.version }}
346350
IS_PRERELEASE: ${{ steps.new-version.outputs.is_prerelease }}
347351

0 commit comments

Comments
 (0)