π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add Cast release workflow support
Neeraj Guptacfca72447fb6
diff --git a/.github/docs/app-release.md b/.github/docs/app-release.mdindex 5336d6f7c4..848a0daf0a 100644--- a/.github/docs/app-release.md+++ b/.github/docs/app-release.md@@ -1,6 +1,6 @@# App release process-Photos, Auth, Locker, Ensu, and Photos desktop use the same release process, as described here.+Photos, Auth, Locker, Ensu, Cast, and Photos desktop use the same release process, as described here.> 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`.>@@ -9,6 +9,7 @@ Photos, Auth, Locker, Ensu, and Photos desktop use the same release process, as## App specifics- Photos desktop follows the same flow, but its stable releases live in [ente/photos-desktop](https://github.com/ente/photos-desktop). See [desktop/docs/release.md](../../desktop/docs/release.md) for more details.+- Cast uses two-part versions, such as `1.2`, and its build workflow is manual. After starting a Cast release, run `cast-build.yml` on the new release branch to upload the RC to TestFlight and create its draft GitHub release.## Normal developmentdiff --git a/.github/scripts/app-version.mjs b/.github/scripts/app-version.mjsindex b159791431..50d831fe02 100644--- a/.github/scripts/app-version.mjs+++ b/.github/scripts/app-version.mjs@@ -13,6 +13,7 @@ const scripts = {auth: ["flutter-version.mjs", "auth"],locker: ["flutter-version.mjs", "locker"],ensu: ["ensu-version.mjs"],+ cast: ["cast-version.mjs"],"photos-desktop": ["photos-desktop-version.mjs"],};@@ -30,6 +31,7 @@ const versionFiles = {"apple/apps/ensu/Ensu.xcodeproj/project.pbxproj","apple/apps/ensu/Ensu/Info.plist",],+ cast: ["apple/apps/cast/Cast.xcodeproj/project.pbxproj"],};function usage() {diff --git a/.github/scripts/cast-version.mjs b/.github/scripts/cast-version.mjsnew file mode 100644index 0000000000..055152cb2a--- /dev/null+++ b/.github/scripts/cast-version.mjs@@ -0,0 +1,86 @@+#!/usr/bin/env node++import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";++const root = path.resolve(+ path.dirname(fileURLToPath(import.meta.url)),+ "../..",+);+const xcode = path.join(root, "apple/apps/cast/Cast.xcodeproj/project.pbxproj");++function source() {+ return fs.readFileSync(xcode, "utf8");+}++function fieldPattern(name) {+ return new RegExp(+ `(${name} = )([^;]+)(;[^}]*PRODUCT_BUNDLE_IDENTIFIER = io\\.ente\\.frame\\.tv\\.cast;)`,+ );+}++function value(name) {+ const found = source().match(fieldPattern(name))?.[2];+ if (!found) throw new Error(`${name}: no Cast Release entry found`);+ return found;+}++function set(name, next) {+ const text = source();+ const pattern = fieldPattern(name);+ if (!pattern.test(text))+ throw new Error(`${name}: no Cast Release entry found`);+ fs.writeFileSync(xcode, text.replace(pattern, `$1${next}$3`));+}++function checkVersion(version) {+ if (!/^\d+\.\d+$/.test(version))+ throw new Error(`Invalid Cast version: ${version}`);+}++function checkBuild(build) {+ if (!/^\d+$/.test(build))+ throw new Error(`Invalid Cast build number: ${build}`);+}++function usage() {+ console.error(`Usage:+ node .github/scripts/cast-version.mjs get+ node .github/scripts/cast-version.mjs get-build-base+ node .github/scripts/cast-version.mjs set 1.2+ node .github/scripts/cast-version.mjs set-build 1.2 34+ node .github/scripts/cast-version.mjs bump-build`);+}++const [command = "get", ...args] = process.argv.slice(2);++try {+ if (command === "get") {+ const version = value("MARKETING_VERSION");+ checkVersion(version);+ console.log(version);+ } else if (command === "get-build-base") {+ const build = value("CURRENT_PROJECT_VERSION");+ checkBuild(build);+ console.log(build);+ } else if (command === "set") {+ checkVersion(args[0]);+ set("MARKETING_VERSION", args[0]);+ } else if (command === "set-build") {+ checkVersion(args[0]);+ checkBuild(args[1]);+ set("MARKETING_VERSION", args[0]);+ set("CURRENT_PROJECT_VERSION", args[1]);+ } else if (command === "bump-build") {+ const build = value("CURRENT_PROJECT_VERSION");+ checkBuild(build);+ set("CURRENT_PROJECT_VERSION", Number(build) + 1);+ } else {+ usage();+ process.exit(2);+ }+} catch (error) {+ console.error(error.message);+ process.exit(1);+}diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.ymlindex 5205960c7e..6a24b460af 100644--- a/.github/workflows/app-release.yml+++ b/.github/workflows/app-release.yml@@ -14,6 +14,7 @@ on:- auth- locker- ensu+ - cast- photos-desktopaction:description: "Release action"@@ -49,8 +50,15 @@ jobs:- name: Validate version inputshell: bashrun: |- if [[ ! "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then- echo "::error::version must be x.y.z"+ if [[ "${APP}" == "cast" ]]; then+ pattern='^[0-9]+\.[0-9]+$'+ example=x.y+ else+ pattern='^[0-9]+\.[0-9]+\.[0-9]+$'+ example=x.y.z+ fi+ if [[ ! "${VERSION}" =~ ${pattern} ]]; then+ echo "::error::version must be ${example}"exit 1fi@@ -104,9 +112,14 @@ jobs:release_branch="release/${APP}-v${VERSION}"beta_tag="${APP}-v${VERSION}-beta"- IFS=. read -r major minor patch <<< "${VERSION}"expected_main_version="${VERSION}"- next_version="${major}.${minor}.$((patch + 1))"+ if [ "${APP}" = "cast" ]; then+ IFS=. read -r major minor <<< "${VERSION}"+ next_version="${major}.$((minor + 1))"+ else+ IFS=. read -r major minor patch <<< "${VERSION}"+ next_version="${major}.${minor}.$((patch + 1))"+ fiif [ "${APP}" = "ensu" ] || [ "${APP}" = "photos-desktop" ]; thenexpected_main_version="${VERSION}-beta"next_version="${next_version}-beta"@@ -130,14 +143,18 @@ jobs:figit_push_with_app_token "${release_branch}"- gh release delete "${beta_tag}" --yes --cleanup-tag --repo ente/nightly || true- git push origin ":refs/tags/${beta_tag}" || true+ if [ "${APP}" != "cast" ]; then+ gh release delete "${beta_tag}" --yes --cleanup-tag --repo ente/nightly || true+ git push origin ":refs/tags/${beta_tag}" || true+ figit switch -c "${next_branch}" mainapp_version set "${next_version}"CHANGES_DIR="mobile/apps/${APP}/changes"if [ "${APP}" = "ensu" ]; thenCHANGES_DIR="rust/apps/ensu/changes"+ elif [ "${APP}" = "cast" ]; then+ CHANGES_DIR="apple/apps/cast/changes"elif [ "${APP}" = "photos-desktop" ]; thenCHANGES_DIR="desktop/changes"fi@@ -223,12 +240,14 @@ jobs:gh release edit "${rc_tag}" --tag "${final_tag}" --title "${final_tag}" --target "${release_sha}" --draft=false --prerelease=false --verify-taggit push origin ":refs/tags/${rc_tag}" || true- gh release delete "${rc_tag}" --yes --cleanup-tag --repo ente/nightly || true+ if [ "${APP}" != "cast" ]; then+ gh release delete "${rc_tag}" --yes --cleanup-tag --repo ente/nightly || true+ figit_push_with_app_token ":refs/heads/${release_branch}"sync-docs:needs: release- if: inputs.action == 'promote'+ if: inputs.action == 'promote' && inputs.app != 'cast'runs-on: ubuntu-latestenvironment:name: release-branch-pushdiff --git a/.github/workflows/cast-build.yml b/.github/workflows/cast-build.ymlindex 514e2cc58e..6056e46d5d 100644--- a/.github/workflows/cast-build.yml+++ b/.github/workflows/cast-build.yml@@ -4,7 +4,7 @@ on:workflow_dispatch:permissions:- contents: read+ contents: writeconcurrency:group: cast-build@@ -19,19 +19,32 @@ jobs:steps:- name: Checkoutuses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ ref: ${{ github.ref_name }}- - name: Prepare build metadata+ - name: Prepare releaseid: metadata- working-directory: apple/apps/castrun: |- settings="$(xcodebuild -showBuildSettings -project Cast.xcodeproj -scheme Cast -configuration Release)"- build_base="$(awk '$1 == "CURRENT_PROJECT_VERSION" { print $3; exit }' <<< "${settings}")"- if [[ ! "${build_base}" =~ ^[0-9]+$ ]]; then- echo "::error::CURRENT_PROJECT_VERSION must be an integer"- exit 1+ set -euo pipefail++ version="$(node .github/scripts/cast-version.mjs get)"+ build_base="$(node .github/scripts/cast-version.mjs get-build-base)"++ if [[ "${GITHUB_REF_NAME}" == release/cast-v* ]]; then+ if [[ "${GITHUB_REF_NAME}" != "release/cast-v${version}" ]]; then+ echo "::error::Branch ${GITHUB_REF_NAME} does not match Cast version ${version}"+ exit 1+ fi+ build_number="${build_base}"+ release_tag="cast-v${version}-rc"+ echo "release_tag=${release_tag}" >> "${GITHUB_OUTPUT}"+ node .github/scripts/release-notes.mjs apple/apps/cast/changes "${release_tag}" >> "${GITHUB_OUTPUT}"+ else+ build_number="$((build_base + GITHUB_RUN_NUMBER))"fi- build_number="$((build_base + GITHUB_RUN_NUMBER))"+echo "build_number=${build_number}" >> "${GITHUB_OUTPUT}"+ echo "commit_sha=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"- name: Generate Cast bindingsworking-directory: rust@@ -79,3 +92,24 @@ jobs:-authenticationKeyPath "${key_path}" \-authenticationKeyID "${ASC_KEY_ID}" \-authenticationKeyIssuerID "${ASC_ISSUER_ID}"++ - name: Create RC draft+ if: startsWith(github.ref_name, 'release/cast-v')+ uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0+ with:+ tag: ${{ steps.metadata.outputs.release_tag }}+ name: ${{ steps.metadata.outputs.release_tag }}+ body: ${{ steps.metadata.outputs.release_body }}+ commit: ${{ steps.metadata.outputs.commit_sha }}+ draft: true+ allowUpdates: true+ updateOnlyUnreleased: true++ - name: Point RC tag at the successfully uploaded commit+ if: startsWith(github.ref_name, 'release/cast-v')+ env:+ COMMIT_SHA: ${{ steps.metadata.outputs.commit_sha }}+ RELEASE_TAG: ${{ steps.metadata.outputs.release_tag }}+ run: |+ git tag --force "${RELEASE_TAG}" "${COMMIT_SHA}"+ git push --force origin "refs/tags/${RELEASE_TAG}"diff --git a/apple/apps/cast/Cast.xcodeproj/project.pbxproj b/apple/apps/cast/Cast.xcodeproj/project.pbxprojindex 623d04da33..1fb935b25d 100644--- a/apple/apps/cast/Cast.xcodeproj/project.pbxproj+++ b/apple/apps/cast/Cast.xcodeproj/project.pbxproj@@ -483,7 +483,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 1.1;+ MARKETING_VERSION = 1.2;OTHER_LDFLAGS = ("$(inherited)","$(TARGET_TEMP_DIR)/cast_rust/libcast.a",