Skip to content

Commit 83bc768

Browse files
p2arthurlempira
authored andcommitted
Merge pull request #124 from algorandfoundation/chore/bot-token-workflow
Chore/bot token workflow
2 parents 831019a + ec98c70 commit 83bc768

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

.github/workflows/prod_release.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,41 @@ name: Prod Publish
33
on:
44
workflow_dispatch:
55

6-
permissions:
7-
contents: write
86

97
jobs:
108
prod_release:
119
runs-on: ubuntu-latest
1210
steps:
13-
- name: Clone repository
14-
uses: actions/checkout@v3
11+
# Step to generate the bot token for semantic release
12+
- name: Generate bot token
13+
uses: actions/create-github-app-token@v1
14+
id: app_token
15+
with:
16+
app_id: ${{ secrets.BOT_ID}}
17+
private_key: ${{ secrets.BOT_SK }}
18+
19+
- uses: actions/checkout@v4
1520
with:
1621
fetch-depth: 0
22+
token: ${{ steps.app_token.outputs.token }}
23+
24+
# Set git user to the GitHub App
25+
- name: Set Git user as GitHub actions
26+
run: git config --global user.email "179917785+engineering-ci[bot]@users.noreply.github.com" && git config --global user.name "engineering-ci[bot]"
27+
28+
1729
- name: Merge main -> release
1830
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
1931
with:
2032
type: now
2133
from_branch: main
2234
target_branch: release
23-
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
github_token: ${{ steps.app_token.outputs.token }}
2436
- name: Merge release -> main
2537
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
2638
with:
2739
type: now
2840
from_branch: release
2941
target_branch: main
3042
message: Merge release back to main to get version increment [no ci]
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
github_token: ${{ steps.app_token.outputs.token }}

.github/workflows/release.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ on:
99

1010
concurrency: release
1111

12-
permissions:
13-
contents: write
14-
issues: write
15-
checks: write
16-
1712
jobs:
1813
ci:
1914
name: Continuous Integration
@@ -61,10 +56,23 @@ jobs:
6156
needs: build
6257
runs-on: ubuntu-latest
6358
steps:
64-
- name: Clone repository
65-
uses: actions/checkout@v3
59+
60+
# Step to generate the bot token for semantic release
61+
- name: Generate bot token
62+
uses: actions/create-github-app-token@v1
63+
id: app_token
64+
with:
65+
app_id: ${{ secrets.BOT_ID}}
66+
private_key: ${{ secrets.BOT_SK }}
67+
68+
- uses: actions/checkout@v4
6669
with:
6770
fetch-depth: 0
71+
token: ${{ steps.app_token.outputs.token }}
72+
73+
# Set git user to the GitHub App
74+
- name: Set Git user as GitHub actions
75+
run: git config --global user.email "179917785+engineering-ci[bot]@users.noreply.github.com" && git config --global user.name "engineering-ci[bot]"
6876

6977
# semantic-release needs node 20
7078
- name: Use Node.js 20.x
@@ -90,5 +98,6 @@ jobs:
9098
- name: 'Semantic release'
9199
run: npx semantic-release
92100
env:
93-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
# Use the GitHub App token for authentication
102+
GITHUB_TOKEN: ${{ steps.app_token.outputs.token }}
94103
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)