2323 name : " Bump ${{ inputs.project }} Version to v${{ inputs.version_number }}"
2424 runs-on : ubuntu-24.04
2525 permissions :
26- contents : read
26+ contents : write
2727 id-token : write
2828 steps :
2929 - name : Install rust
@@ -48,44 +48,41 @@ jobs:
4848 id : retrieve-secrets
4949 uses : bitwarden/gh-actions/get-keyvault-secrets@main
5050 with :
51- keyvault : " bitwarden-ci"
52- secrets : " github-gpg-private-key,
53- github-gpg-private-key-passphrase,
54- github-pat-bitwarden-devops-bot-repo-scope"
51+ keyvault : " gh-org-bitwarden"
52+ secrets : " BW-GHAPP-ID,BW-GHAPP-KEY"
5553
5654 - name : Log out from Azure
5755 uses : bitwarden/gh-actions/azure-logout@main
5856
57+ - name : Generate GH App token
58+ uses : actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
59+ id : app-token
60+ with :
61+ app-id : ${{ steps.retrieve-secrets.outputs.BW-GHAPP-ID }}
62+ private-key : ${{ steps.retrieve-secrets.outputs.BW-GHAPP-KEY }}
63+ repositories : sdk-internal
64+ permissions : >-
65+ contents: write
66+ pull-requests: write
67+
5968 - name : Checkout Branch
6069 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6170 with :
6271 ref : main
63- repository : bitwarden/sdk
72+ repository : bitwarden/sdk-internal
73+ token : ${{ steps.app-token.outputs.token }}
6474 persist-credentials : true
6575
66- - name : Import GPG key
67- uses : crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
68- with :
69- gpg_private_key : ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
70- passphrase : ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
71- git_user_signingkey : true
72- git_commit_gpgsign : true
73-
74- - name : Create Version Branch
75- id : branch
76- env :
77- VERSION : ${{ inputs.version_number }}
78- PROJECT : ${{ inputs.project }}
79- run : git switch -c sdk-${PROJECT}_version_bump_${VERSION}
80-
8176 - name : Create Version Branch
8277 id : create-branch
8378 env :
84- REF_NAME : ${{ github.ref_name }}
8579 PROJECT : ${{ inputs.project }}
8680 VERSION_NUMBER : ${{ inputs.version_number }}
81+ RUN_NUMBER : ${{ github.run_number }}
8782 run : |
88- NAME=version_bump_$REF_NAME_$PROJECT_$VERSION_NUMBER
83+ NAME=version_bump_${PROJECT}_${VERSION_NUMBER}_${RUN_NUMBER}
84+ # Delete remote branch if it exists
85+ git push origin --delete $NAME 2>/dev/null || true
8986 git switch -c $NAME
9087 echo "name=$NAME" >> $GITHUB_OUTPUT
9188
@@ -130,7 +127,7 @@ jobs:
130127 env :
131128 VERSION_NUMBER : ${{ inputs.version_number }}
132129 PROJECT : ${{ inputs.project }}
133- run : git commit -m "Bumped sdk-$PROJECT version to $VERSION_NUMBER" -a
130+ run : git commit --no-verify - m "Bumped sdk-$PROJECT version to $VERSION_NUMBER" -a
134131
135132 - name : Push changes
136133 if : ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
@@ -142,7 +139,7 @@ jobs:
142139 if : ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
143140 id : create-pr
144141 env :
145- GH_TOKEN : ${{ steps.retrieve-secrets .outputs.github-pat-bitwarden-devops-bot-repo-scope }}
142+ GH_TOKEN : ${{ steps.app-token .outputs.token }}
146143 PR_BRANCH : ${{ steps.create-branch.outputs.name }}
147144 TITLE : " Bump ${{ inputs.project }} version to ${{ inputs.version_number }}"
148145 PROJECT : ${{ inputs.project }}
@@ -153,27 +150,12 @@ jobs:
153150 --head "$PR_BRANCH" \
154151 --label "version update" \
155152 --label "automated pr" \
156- --body "
157- ## Type of change
158- - [ ] Bug fix
159- - [ ] New feature development
160- - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
161- - [ ] Build/deploy pipeline (DevOps)
162- - [X] Other
163-
164- ## Objective
165- Automated $PROJECT version bump to $VERSION_NUMBER.")
153+ --body "Automated $PROJECT version bump to $VERSION_NUMBER.")
166154 echo "pr_number=${PR_URL##*/}" >> $GITHUB_OUTPUT
167155
168- - name : Approve PR
169- env :
170- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171- PR_NUMBER : ${{ steps.create-pr.outputs.pr_number }}
172- run : gh pr review $PR_NUMBER --approve
173-
174156 - name : Merge PR
175157 env :
176- GH_TOKEN : ${{ steps.retrieve-secrets .outputs.github-pat-bitwarden-devops-bot-repo-scope }}
158+ GH_TOKEN : ${{ steps.app-token .outputs.token }}
177159 PR_NUMBER : ${{ steps.create-pr.outputs.pr_number }}
178160 run : gh pr merge $PR_NUMBER --squash --auto --delete-branch
179161
0 commit comments