Skip to content

Commit 87a5092

Browse files
committed
chore: release script to use short live github token
1 parent 8874f2d commit 87a5092

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.github/workflows/publish.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ jobs:
1515
if: github.ref == 'refs/heads/master'
1616
runs-on: ubuntu-latest
1717
steps:
18+
- uses: actions/create-github-app-token@v2
19+
id: create_github_app_token
20+
with:
21+
app-id: ${{ secrets.GH_APP_PUSHER_ID }}
22+
private-key: ${{ secrets.GH_APP_PUSHER_PRIVATE_KEY }}
23+
1824
- uses: actions/checkout@v4
1925
with:
20-
token: ${{ secrets.GH_PAT }}
26+
token: ${{ steps.create_github_app_token.outputs.token }}
2127
fetch-depth: 0
2228

2329
- uses: actions/setup-node@v4
@@ -36,11 +42,6 @@ jobs:
3642
run: |
3743
npx zx ./scripts/publish.mjs --version="${{ inputs.version }}"
3844
39-
- uses: actions/create-github-app-token@v2
40-
id: create_github_app_token
41-
with:
42-
app-id: ${{ secrets.GH_APP_PUSHER_ID }}
43-
private-key: ${{ secrets.GH_APP_PUSHER_PRIVATE_KEY }}
4445
- name: Publish release
4546
env:
4647
GITHUB_TOKEN: ${{ steps.create_github_app_token.outputs.token }}

scripts/gitrelease.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const nextTag = `v${nextVersion}`;
88

99
echo`Publishing ${nextVersion} on branch ${branch}`;
1010

11-
// Configure git to use the GitHub token for authentication
12-
await $`git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"`;
11+
await $`git config --global user.email "contact@nango.dev"`;
12+
await $`git config --global user.name "Release Bot"`;
1313

1414
const tagExists = await $`git tag -l ${nextTag}`;
1515
if (tagExists.stdout !== '') {
@@ -30,14 +30,14 @@ echo`Adding file`;
3030
await $`git add -A package.json package-lock.json packages/**/package.json CHANGELOG.md packages/**/lib/version.ts`;
3131

3232
echo`Creating commit`;
33-
await $`git -c user.name="Release Bot" -c user.email="contact@nango.dev" commit --allow-empty --author="Release Bot <contact@nango.dev>" -m ${releaseMessage} `;
33+
await $`git commit --allow-empty --author="Release Bot <contact@nango.dev>" -m ${releaseMessage} `;
3434

3535
echo`Creating tag`;
36-
await $`git -c user.name="Release Bot" -c user.email="contact@nango.dev" tag -a ${nextTag} HEAD -m ${releaseMessage}`;
36+
await $`git tag -a ${nextTag} HEAD -m ${releaseMessage}`;
3737

3838
echo`Pushing`;
3939
await $`git push --follow-tags origin HEAD:refs/heads/${branch}`;
40-
await $`git push --tags`;
40+
await $`git push --tags origin`;
4141

4242
echo`Commit pushed, publishing release...`;
4343
// Push GitHub release

0 commit comments

Comments
 (0)