Skip to content

armgit / ente

Public Imported from GitHub
0

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

Restrict app releases to maintainers and merged fixes

Manav Rathi7fc93330147a
diff --git a/.github/docs/app-release.md b/.github/docs/app-release.md
index 2b4baa1099..17a91da042 100644
--- a/.github/docs/app-release.md
+++ b/.github/docs/app-release.md
@@ -2,6 +2,8 @@
Photos, Auth, Locker, Ensu, Cast, and Photos desktop use the same release process, as described here.
+Only primary maintainers can run `app-release.yml`.
+
> For simplicity, the following assumes we're trying to release Ensu, that main is `0.1.16-beta`, we want to release `0.1.16` and move main to `0.1.17-beta`.
>
> To do the same steps for another app, say "auth", you can just mechanically replace "ensu" with that "auth" in the steps.
@@ -48,6 +50,8 @@ The workflow also opens a PR to move `main` to `0.1.17-beta`. Merge that PR afte
Run the update action with the full SHA of the fix to cherry-pick a commit into the release branch and create a new RC build.
+The commit must already be on `main`.
+
```sh
gh workflow run app-release.yml \
-f action=update \
diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.yml
index c44b4b6dfb..3c9467bf0c 100644
--- a/.github/workflows/app-release.yml
+++ b/.github/workflows/app-release.yml
@@ -53,6 +53,20 @@ jobs:
COMMIT: ${{ inputs.commit }}
steps:
+ - name: Check release maintainer
+ env:
+ GH_TOKEN: ${{ github.token }}
+ TRIGGERING_ACTOR: ${{ github.triggering_actor }}
+ run: |
+ actor_id="$(gh api "/users/${TRIGGERING_ACTOR}" --jq .id)"
+ case "${actor_id}" in
+ 24503581|254676) ;;
+ *)
+ echo "::error::${TRIGGERING_ACTOR} is not a release maintainer"
+ exit 1
+ ;;
+ esac
+
- name: Validate version input
shell: bash
run: |
@@ -70,6 +84,20 @@ jobs:
exit 1
fi
+ - name: Verify commit is on main
+ if: inputs.action == 'update'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ status="$(gh api "/repos/${GITHUB_REPOSITORY}/compare/${COMMIT}...main?per_page=1" --jq .status)"
+ case "${status}" in
+ ahead|identical) ;;
+ *)
+ echo "::error::commit must already be on main"
+ exit 1
+ ;;
+ esac
+
- name: Checkout main
if: inputs.action == 'start'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1