Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Wire Ensu release branch push token

Manav Rathi92468826dd0d
diff --git a/.github/docs/secrets.md b/.github/docs/secrets.md
new file mode 100644
index 0000000000..3cc66bc541
--- /dev/null
+++ b/.github/docs/secrets.md
@@ -0,0 +1,7 @@
+# Secrets
+
+## RELEASE_BRANCH_PUSH_TOKEN
+
+- Fine-grained PAT for `ente-io/ente` with `Contents: read/write`.
+- Used by the workflows which trigger releases to create, update, and delete `release/*` branches.
+- The PAT owner must be allowed to bypass the `release/*` branch ruleset.
diff --git a/.github/workflows/ensu-release.yml b/.github/workflows/ensu-release.yml
index d487a86e79..8e40cf550c 100644
--- a/.github/workflows/ensu-release.yml
+++ b/.github/workflows/ensu-release.yml
@@ -28,6 +28,8 @@ concurrency:
jobs:
release:
runs-on: ubuntu-latest
+ environment:
+ name: release-branch-push
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ inputs.version }}
@@ -53,9 +55,16 @@ jobs:
- name: Start release
if: inputs.action == 'start'
+ env:
+ RELEASE_BRANCH_PUSH_TOKEN: ${{ secrets.RELEASE_BRANCH_PUSH_TOKEN }}
run: |
set -euo pipefail
+ git_push_release_branch() {
+ git -c http.https://github.com/.extraheader= push \
+ "https://x-access-token:${RELEASE_BRANCH_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$@"
+ }
+
release_branch="release/ensu-v${VERSION}"
beta_tag="ensu-v${VERSION}-beta"
IFS=. read -r major minor patch <<< "${VERSION}"
@@ -71,7 +80,7 @@ jobs:
git switch -c "${release_branch}"
node .github/scripts/ensu-version.mjs set "${VERSION}"
git commit -am "Ensu v${VERSION}"
- git push -u origin "${release_branch}"
+ git_push_release_branch "${release_branch}"
gh release delete "${beta_tag}" --yes || true
git push origin ":refs/tags/${beta_tag}" || true
@@ -86,9 +95,16 @@ jobs:
- name: Finalize release
if: inputs.action == 'finalize'
+ env:
+ RELEASE_BRANCH_PUSH_TOKEN: ${{ secrets.RELEASE_BRANCH_PUSH_TOKEN }}
run: |
set -euo pipefail
+ git_push_release_branch() {
+ git -c http.https://github.com/.extraheader= push \
+ "https://x-access-token:${RELEASE_BRANCH_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$@"
+ }
+
release_branch="release/ensu-v${VERSION}"
rc_tag="ensu-v${VERSION}-rc"
final_tag="ensu-v${VERSION}"
@@ -112,4 +128,4 @@ jobs:
gh release edit "${rc_tag}" --tag "${final_tag}" --title "${final_tag}" --target "${release_sha}" --draft --verify-tag
git push origin ":refs/tags/${rc_tag}" || true
- git push origin ":refs/heads/${release_branch}"
+ git_push_release_branch ":refs/heads/${release_branch}"