π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[infra] Simplify Ensu release workflow
Manav Rathi260f714c241a
diff --git a/.github/docs/ensu-release.md b/.github/docs/ensu-release.mdindex 2da6f9fc2e..434e825e71 100644--- a/.github/docs/ensu-release.md+++ b/.github/docs/ensu-release.md@@ -47,8 +47,8 @@ This does not create another build. It tags the last RC commit as `ensu-v0.1.16`## Retries-Both workflows are safe to retry for transient failures.+`ensu-build.yml` is safe to retry. Both nightly and RC builds update fixed draft releases (`ensu-v0.1.16-beta` and `ensu-v0.1.16-rc`), and reruns update the same draft.-For `ensu-build.yml`, both nightly or RC builds update fixed drafts (`ensu-v0.1.16-beta` and `ensu-v0.1.16-rc`). Re-running failed jobs, or triggering `ensu-build.yml` again, updates the same draft.+> If a build has already reached Play Store or TestFlight, trigger a new workflow run instead of re-running failed jobs so that it gets a new build number.-For `ensu-release.yml`, retries resume the same release state. `action=start` keeps using the existing release branch and next-beta PR. `action=finalize` does not build, and deletes the release branch only after the final draft is ready.\ No newline at end of file+`ensu-release.yml` changes release state. If it fails, inspect the failed step before re-running. After it has pushed a branch, created a tag, or moved a draft release, either finish the remaining step manually or undo the partial state first. Cleanup is intentionally late: `action=start` pushes the release branch before deleting the beta draft, and `action=finalize` deletes the release branch last.diff --git a/.github/workflows/ensu-build.yml b/.github/workflows/ensu-build.ymlindex 3c3183d2ab..eb4fb35446 100644--- a/.github/workflows/ensu-build.yml+++ b/.github/workflows/ensu-build.yml@@ -23,7 +23,7 @@ concurrency:cancel-in-progress: falsejobs:- release-metadata:+ build-metadata:runs-on: ubuntu-22.04outputs:@@ -85,9 +85,9 @@ jobs:echo "release_body=${RELEASE_BODY}" >> "${GITHUB_OUTPUT}"echo "build_number=${build_number}" >> "${GITHUB_OUTPUT}"- release-desktop:- needs: release-metadata- if: needs.release-metadata.outputs.should_build == 'true'+ build-desktop:+ needs: build-metadata+ if: needs.build-metadata.outputs.should_build == 'true'strategy:fail-fast: falsematrix:@@ -107,16 +107,16 @@ jobs:runs-on: ${{ matrix.platform.os }}env:- COMMIT_SHA: ${{ needs.release-metadata.outputs.commit_sha }}- RELEASE_TAG: ${{ needs.release-metadata.outputs.release_tag }}- RELEASE_BODY: ${{ needs.release-metadata.outputs.release_body }}+ COMMIT_SHA: ${{ needs.build-metadata.outputs.commit_sha }}+ RELEASE_TAG: ${{ needs.build-metadata.outputs.release_tag }}+ RELEASE_BODY: ${{ needs.build-metadata.outputs.release_body }}HAS_WINDOWS_SIGNING: ${{ secrets.AZURE_TENANT_ID != '' && secrets.AZURE_CLIENT_ID != '' && secrets.AZURE_CLIENT_SECRET != '' && secrets.AZURE_ENDPOINT != '' && secrets.AZURE_CODE_SIGNING_NAME != '' && secrets.AZURE_CERT_PROFILE_NAME != '' }}steps:- name: Checkout codeuses: actions/checkout@v6with:- ref: ${{ needs.release-metadata.outputs.commit_sha }}+ ref: ${{ needs.build-metadata.outputs.commit_sha }}- name: Setup Node.jsuses: actions/setup-node@v6@@ -285,15 +285,15 @@ jobs:args: ${{ format('--target {0} --bundles {1} --features updater', matrix.platform.rust-target, matrix.platform.bundle-targets) }}build-android:- needs: release-metadata- if: needs.release-metadata.outputs.should_build == 'true'+ needs: build-metadata+ if: needs.build-metadata.outputs.should_build == 'true'runs-on: ubuntu-22.04env:- COMMIT_SHA: ${{ needs.release-metadata.outputs.commit_sha }}- RELEASE_TAG: ${{ needs.release-metadata.outputs.release_tag }}- RELEASE_BODY: ${{ needs.release-metadata.outputs.release_body }}- SHORT_SHA: ${{ needs.release-metadata.outputs.short_sha }}- BUILD_NUMBER: ${{ needs.release-metadata.outputs.build_number }}+ COMMIT_SHA: ${{ needs.build-metadata.outputs.commit_sha }}+ RELEASE_TAG: ${{ needs.build-metadata.outputs.release_tag }}+ RELEASE_BODY: ${{ needs.build-metadata.outputs.release_body }}+ SHORT_SHA: ${{ needs.build-metadata.outputs.short_sha }}+ BUILD_NUMBER: ${{ needs.build-metadata.outputs.build_number }}HAS_DISCORD_WEBHOOK: ${{ secrets.DISCORD_INTERNAL_RELEASE_WEBHOOK != '' }}defaults:@@ -304,7 +304,7 @@ jobs:- name: Checkout codeuses: actions/checkout@v6with:- ref: ${{ needs.release-metadata.outputs.commit_sha }}+ ref: ${{ needs.build-metadata.outputs.commit_sha }}- name: Setup JDK 17uses: actions/setup-java@v4@@ -381,21 +381,21 @@ jobs:${{ env.RELEASE_TAG }} ([${{ env.SHORT_SHA }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ env.COMMIT_SHA }})) Β· [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }})color: 0xFDCE13- mark-built-release:- needs: [release-metadata, release-desktop, build-android]- if: needs.release-metadata.outputs.should_build == 'true'+ mark-built-tag:+ needs: [build-metadata, build-desktop, build-android]+ if: needs.build-metadata.outputs.should_build == 'true'runs-on: ubuntu-22.04steps:- name: Checkout built commituses: actions/checkout@v6with:- ref: ${{ needs.release-metadata.outputs.commit_sha }}+ ref: ${{ needs.build-metadata.outputs.commit_sha }}- name: Point release tag at the successfully built commitenv:- RELEASE_TAG: ${{ needs.release-metadata.outputs.release_tag }}- COMMIT_SHA: ${{ needs.release-metadata.outputs.commit_sha }}+ RELEASE_TAG: ${{ needs.build-metadata.outputs.release_tag }}+ COMMIT_SHA: ${{ needs.build-metadata.outputs.commit_sha }}run: |set -euo pipefaildiff --git a/.github/workflows/ensu-release.yml b/.github/workflows/ensu-release.ymlindex c1642cc7e5..d827a84ca3 100644--- a/.github/workflows/ensu-release.yml+++ b/.github/workflows/ensu-release.yml@@ -27,80 +27,61 @@ concurrency:jobs:release:- runs-on: ubuntu-22.04+ runs-on: ubuntu-latestenv:GH_TOKEN: ${{ github.token }}VERSION: ${{ inputs.version }}steps:- name: Checkout main+ if: inputs.action == 'start'uses: actions/checkout@v6with:ref: main- fetch-depth: 0++ - name: Checkout release branch+ if: inputs.action == 'finalize'+ uses: actions/checkout@v6+ with:+ ref: release/ensu-v${{ inputs.version }}- name: Configure Git+ if: inputs.action == 'start'run: |git config user.name "github-actions[bot]"git config user.email "41898282+github-actions[bot]@users.noreply.github.com"- - name: Validate version- run: |- set -euo pipefail-- if [[ ! "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then- echo "::error::Invalid version ${VERSION}"- exit 1- fi-- name: Start releaseif: inputs.action == 'start'run: |set -euo pipefail+ release_branch="release/ensu-v${VERSION}"+ beta_tag="ensu-v${VERSION}-beta"IFS=. read -r major minor patch <<< "${VERSION}"next_version="${major}.${minor}.$((patch + 1))-beta"- release_branch="release/ensu-v${VERSION}"next_branch="ensu-v${next_version}"- beta_tag="ensu-v${VERSION}-beta"- git fetch origin main- if git ls-remote --exit-code --heads origin "${release_branch}" >/dev/null; then- git fetch origin "${release_branch}"- git switch -C "${release_branch}" "origin/${release_branch}"- else- git switch -c "${release_branch}" origin/main- version="$(node .github/scripts/ensu-version.mjs get)"- if [ "${version}" != "${VERSION}-beta" ]; then- echo "::error::main is ${version}, expected ${VERSION}-beta"- exit 1- fi+ main_version="$(node .github/scripts/ensu-version.mjs get)"+ if [ "${main_version}" != "${VERSION}-beta" ]; then+ echo "::error::main is ${main_version}, expected ${VERSION}-beta"+ exit 1fi+ git switch -c "${release_branch}"node .github/scripts/ensu-version.mjs set "${VERSION}"- if ! git diff --quiet; then- git commit -am "Ensu v${VERSION}"- fi- gh release delete "${beta_tag}" --yes || true- git push origin ":refs/tags/${beta_tag}" 2>/dev/null || true+ git commit -am "Ensu v${VERSION}"git push -u origin "${release_branch}"- if git ls-remote --exit-code --heads origin "${next_branch}" >/dev/null; then- git fetch origin "${next_branch}"- git switch -C "${next_branch}" "origin/${next_branch}"- else- git switch -c "${next_branch}" origin/main- fi+ gh release delete "${beta_tag}" --yes || true+ git push origin ":refs/tags/${beta_tag}" || true++ git switch -c "${next_branch}" mainnode .github/scripts/ensu-version.mjs set "${next_version}"- if ! git diff --quiet; then- git commit -am "Start Ensu ${next_version}"- fi+ git commit -am "Start Ensu ${next_version}"git push -u origin "${next_branch}"- pr_number="$(gh pr list --head "${next_branch}" --base main --state open --json number --jq '.[0].number // empty')"- if [ -z "${pr_number}" ]; then- gh pr create --base main --head "${next_branch}" --title "[meta] Start Ensu ${next_version}" --body ""- fi+ gh pr create --base main --head "${next_branch}" --title "[ensu] Start Ensu ${next_version}" --body ""- name: Finalize releaseif: inputs.action == 'finalize'@@ -111,50 +92,23 @@ jobs:rc_tag="ensu-v${VERSION}-rc"final_tag="ensu-v${VERSION}"- git fetch origin "${release_branch}"- git switch -C "${release_branch}" "origin/${release_branch}"- version="$(node .github/scripts/ensu-version.mjs get)"- if [ "${version}" != "${VERSION}" ]; then- echo "::error::${release_branch} is ${version}, expected ${VERSION}"+ branch_version="$(node .github/scripts/ensu-version.mjs get)"+ if [ "${branch_version}" != "${VERSION}" ]; then+ echo "::error::${release_branch} is ${branch_version}, expected ${VERSION}"exit 1firelease_sha="$(git rev-parse HEAD)"- if git fetch origin "refs/tags/${rc_tag}:refs/tags/${rc_tag}" 2>/dev/null; then- rc_sha="$(git rev-parse "${rc_tag}^{commit}")"- if [ "${rc_sha}" != "${release_sha}" ]; then- echo "::error::${rc_tag} does not point at ${release_branch}"- exit 1- fi- elif git fetch origin "refs/tags/${final_tag}:refs/tags/${final_tag}" 2>/dev/null; then- final_sha="$(git rev-parse "${final_tag}^{commit}")"- if [ "${final_sha}" != "${release_sha}" ]; then- echo "::error::${final_tag} does not point at ${release_branch}"- exit 1- fi- else- echo "::error::No RC or final tag found for ${VERSION}"- exit 1- fi+ rc_sha="$(git ls-remote origin "refs/tags/${rc_tag}" | cut -f1)"- if git ls-remote --exit-code --tags origin "refs/tags/${final_tag}" >/dev/null; then- git fetch origin "refs/tags/${final_tag}:refs/tags/${final_tag}"- final_sha="$(git rev-parse "${final_tag}^{commit}")"- if [ "${final_sha}" != "${release_sha}" ]; then- echo "::error::${final_tag} already exists at ${final_sha}"- exit 1- fi- else- git tag "${final_tag}" "${release_sha}"- git push origin "refs/tags/${final_tag}"- fi-- if gh release view "${rc_tag}" >/dev/null 2>&1; then- gh release edit "${rc_tag}" --tag "${final_tag}" --title "${final_tag}" --target "${release_sha}" --draft- elif ! gh release view "${final_tag}" >/dev/null 2>&1; then- echo "::error::No RC or final GitHub release found for ${VERSION}"+ if [ "${rc_sha}" != "${release_sha}" ]; then+ echo "::error::${rc_tag} does not point at ${release_branch}"exit 1fi- git push origin ":refs/tags/${rc_tag}" 2>/dev/null || true+ git tag "${final_tag}" "${release_sha}"+ git push origin "refs/tags/${final_tag}"+ gh release edit "${rc_tag}" --tag "${final_tag}" --title "${final_tag}" --target "${release_sha}" --draft --verify-tag++ git push origin ":refs/tags/${rc_tag}" || truegit push origin ":refs/heads/${release_branch}"