From 36d5aa9f01912cbcf7b5c443086a39c214b37281 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 5 Mar 2024 19:37:51 +0530 Subject: [PATCH] Add mobile release workflow --- .github/workflows/auth-lint.yml | 7 ++- .github/workflows/auth-release.yml | 20 +++----- .github/workflows/cli-release.yml | 3 +- .github/workflows/mobile-lint.yml | 7 ++- .github/workflows/mobile-release.yml | 56 ++++++++++++++++++++++ auth/docs/release.md | 30 ++++++------ mobile/.github/workflows/build.yml | 65 -------------------------- mobile/.github/workflows/release.yml | 70 ---------------------------- 8 files changed, 91 insertions(+), 167 deletions(-) create mode 100644 .github/workflows/mobile-release.yml delete mode 100644 mobile/.github/workflows/build.yml delete mode 100644 mobile/.github/workflows/release.yml diff --git a/.github/workflows/auth-lint.yml b/.github/workflows/auth-lint.yml index 242d9ba182..7c37a51d25 100644 --- a/.github/workflows/auth-lint.yml +++ b/.github/workflows/auth-lint.yml @@ -10,6 +10,9 @@ on: - "auth/**" - ".github/workflows/auth-lint.yml" +env: + FLUTTER_VERSION: "3.16.9" + jobs: lint: runs-on: ubuntu-latest @@ -22,11 +25,11 @@ jobs: with: submodules: recursive - - name: Install Flutter + - name: Install Flutter ${{ env.FLUTTER_VERSION }} uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: "3.13.4" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - run: flutter pub get diff --git a/.github/workflows/auth-release.yml b/.github/workflows/auth-release.yml index e496b492c6..0adaaca287 100644 --- a/.github/workflows/auth-release.yml +++ b/.github/workflows/auth-release.yml @@ -1,14 +1,13 @@ name: "Release (auth)" +# [Note: Testing release workflows that are triggered by tags] +# # To test this out, push a tag with a pre-release version. The version number # should be the version number of the next actual release. # # > When major, minor, and patch are equal, a pre-release version has lower -# > precedence than a normal version: -# > -# > Example: 1.0.0-alpha < 1.0.0. -# > -# > - https://semver.org +# > precedence than a normal version. Example: 1.0.0-alpha < 1.0.0. +# > https://semver.org # # So if the next release we intend to put out is 1.2.3, you can: # @@ -38,7 +37,6 @@ jobs: defaults: run: - # Run all the "run" steps inside the auth directory working-directory: auth steps: @@ -63,7 +61,7 @@ jobs: - name: Create artifacts directory run: mkdir artifacts - - name: Build Android APK + - name: Build independent APK run: | flutter build apk --release --flavor independent --dart-define=app.flavor=independent mv build/app/outputs/flutter-apk/app-independent-release.apk artifacts/ente-${{ github.ref_name }}.apk @@ -115,13 +113,13 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "auth/artifacts/*" - prerelease: true draft: true allowUpdates: true updateOnlyUnreleased: true - name: Upload AAB to PlayStore - # Temporarily disable GP upload + # Temporarily disable GP upload, enable this once desktop build + # testing is complete. if: false uses: r0adkll/upload-google-play@v1 with: @@ -135,7 +133,6 @@ jobs: defaults: run: - # Run all the "run" steps inside the auth directory working-directory: auth steps: @@ -189,7 +186,6 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "auth/artifacts/*" - prerelease: true draft: true allowUpdates: true updateOnlyUnreleased: true @@ -199,7 +195,6 @@ jobs: defaults: run: - # Run all the "run" steps inside the auth directory working-directory: auth steps: @@ -291,7 +286,6 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "auth/artifacts/*" - prerelease: true draft: true allowUpdates: true updateOnlyUnreleased: true diff --git a/.github/workflows/cli-release.yml b/.github/workflows/cli-release.yml index 941becb286..dabfc8dcf7 100644 --- a/.github/workflows/cli-release.yml +++ b/.github/workflows/cli-release.yml @@ -7,6 +7,8 @@ on: # Tip: to test this workflow, push at tag with a pre-release version, # e.g. `cli-v1.2.3-test`, where 1.2.3 is the expected version number of # the next release that'll go out. + # + # See: [Note: Testing release workflows that are triggered by tags] tags: - "cli-v*" @@ -17,7 +19,6 @@ jobs: - name: Create a draft GitHub release uses: ncipollo/release-action@v1 with: - prerelease: true draft: true build: diff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.yml index e38864c4e8..c2e54d38ae 100644 --- a/.github/workflows/mobile-lint.yml +++ b/.github/workflows/mobile-lint.yml @@ -10,6 +10,9 @@ on: - "mobile/**" - ".github/workflows/mobile-lint.yml" +env: + FLUTTER_VERSION: "3.13.4" + jobs: lint: runs-on: ubuntu-latest @@ -22,11 +25,11 @@ jobs: with: submodules: recursive - - name: Install Flutter + - name: Install Flutter ${{ env.FLUTTER_VERSION }} uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: "3.13.4" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - run: flutter pub get diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.yml new file mode 100644 index 0000000000..3868da64a2 --- /dev/null +++ b/.github/workflows/mobile-release.yml @@ -0,0 +1,56 @@ +name: "Release (photos independent)" + +on: + workflow_dispatch: # Allow manually running the action + push: + # Run when a tag matching the pattern "photos-v*"" is pushed + # See: [Note: Testing release workflows that are triggered by tags] + tags: + - "photos-v*" + +env: + FLUTTER_VERSION: "3.13.4" + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: mobile + + steps: + - name: Checkout code and submodules + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Flutter ${{ env.FLUTTER_VERSION }} + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + + - name: Setup keys + uses: timheuer/base64-to-file@v1 + with: + fileName: "keystore/ente_photos_key.jks" + encodedString: ${{ secrets.SIGNING_KEY_PHOTOS }} + + - name: Build independent APK + run: flutter build apk --release --flavor independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente.apk + env: + SIGNING_KEY_PATH: "/home/runner/work/_temp/keystore/ente_photos_key.jks" + SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS_PHOTOS }} + SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD_PHOTOS }} + SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD_PHOTOS }} + + - name: Checksum + run: sha256sum build/app/outputs/flutter-apk/ente.apk > build/app/outputs/flutter-apk/sha256sum + + - name: Create a draft GitHub release + uses: ncipollo/release-action@v1 + with: + artifacts: "mobile/build/app/outputs/flutter-apk/ente.apk,mobile/build/app/outputs/flutter-apk/sha256sum" + draft: true diff --git a/auth/docs/release.md b/auth/docs/release.md index 7ec7a75821..f288497011 100644 --- a/auth/docs/release.md +++ b/auth/docs/release.md @@ -1,26 +1,28 @@ # Releases -Create a PR to bump up the version number in `pubspec.yaml`. +Create a PR to bump up the version in `pubspec.yaml`. Once that is merged, tag +main, and push the tag. -Once that is merged, tag main (using the `auth-v1.2.3` format), and push the -tag. This'll trigger a GitHub workflow that: +```sh +git tag auth-v1.2.3 +git push origin auth-v1.2.3 +``` + +This'll trigger a GitHub workflow that: * Creates a new draft GitHub release and attaches all the build artifacts to it (mobile APKs and various desktop packages), * Creates a new release in the internal track on Play Store. +Once the workflow completes, go to the draft GitHub release that was created. +Set "Previous tag" to the last release of auth and press "Generate release +notes". The generated release note will contain all PRs and new contributors +from all the releases in the monorepo, so you'll need to filter them to keep +only the things that relate to the auth. + +--- + (TODO(MR): Fix this after the monorepo move) Xcode Cloud has already been configured and will automatically build and release to TestFlight when step 1 was merged to main (you can see logs under the PR checks). - -If you want to make changes to the workflow itself, or test it out, you can push -a tag like `auth-v1.2.3-test` (where v1.2.3 is the next expected version that'll -go out). For more details, see the comments on top of the [auth-release -workflow](.github/workflows/auth-release.yml). - -Once the workflow completes, go to the draft GitHub release it that was created. -Use the "Generate release notes" button after setting the "Previous tag" for the -last release of auth. The generated release note will contain all PRs and new -contributors from all the releases in the monorepo, so you'll need to filter -them to keep only the things that relate to auth. diff --git a/mobile/.github/workflows/build.yml b/mobile/.github/workflows/build.yml deleted file mode 100644 index 9174e1127d..0000000000 --- a/mobile/.github/workflows/build.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Manual build - -on: - workflow_dispatch: # Enable manual run only - -jobs: - build: - # This job will run on ubuntu virtual machine - runs-on: ubuntu-latest - steps: - - # Setup Java environment in order to build the Android app. - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'adopt' - java-version: '11' - - # Setup the flutter environment. - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.13.4' - - # Fetch sub modules - - run: git submodule update --init --recursive - - # Get flutter dependencies. - - run: flutter pub get - - - name: Setup keys - uses: timheuer/base64-to-file@v1 - with: - fileName: 'keystore/ente_photos_key.jks' - encodedString: ${{ secrets.SIGNING_KEY }} - - # Build independent apk. - - name: Build - run: flutter build apk --release --flavor independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente.apk - env: - SIGNING_KEY_PATH: '/home/runner/work/_temp/keystore/ente_photos_key.jks' - SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} - SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} - - - name: Checksum - run: sha256sum build/app/outputs/flutter-apk/ente.apk > build/app/outputs/flutter-apk/sha256sum - - # Upload generated apk to the artifacts. - - uses: actions/upload-artifact@v4 - with: - name: release-apk - path: build/app/outputs/flutter-apk/ente.apk - - - uses: actions/upload-artifact@v4 - with: - name: release-checksum - path: build/app/outputs/flutter-apk/sha256sum - - # Create a pre-release - - uses: ncipollo/release-action@v1.14.0 - with: - artifacts: "build/app/outputs/flutter-apk/ente.apk,build/app/outputs/flutter-apk/sha256sum" - token: ${{ secrets.GITHUB_TOKEN }} - prerelease: true diff --git a/mobile/.github/workflows/release.yml b/mobile/.github/workflows/release.yml deleted file mode 100644 index 9b971d3b50..0000000000 --- a/mobile/.github/workflows/release.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Release - -# This workflow is triggered on pushes to the repository. -on: - workflow_dispatch: - # Enable manual run - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v4.2.0 - -jobs: - build: - # This job will run on ubuntu virtual machine - runs-on: ubuntu-latest - steps: - - # Setup Java environment in order to build the Android app. - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '11' - - # Setup the flutter environment. - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.13.4' - - # Fetch sub modules - - run: git submodule update --init --recursive - - # Get flutter dependencies. - - run: flutter pub get - - - name: Setup keys - uses: timheuer/base64-to-file@v1 - with: - fileName: 'keystore/ente_photos_key.jks' - encodedString: ${{ secrets.SIGNING_KEY }} - - # Build independent apk. - - name: Build - run: flutter build apk --release --flavor independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente.apk - env: - SIGNING_KEY_PATH: '/home/runner/work/_temp/keystore/ente_photos_key.jks' - SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} - SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} - - - name: Checksum - run: sha256sum build/app/outputs/flutter-apk/ente.apk > build/app/outputs/flutter-apk/sha256sum - - # Upload generated apk to the artifacts. - - uses: actions/upload-artifact@v2 - with: - name: release-apk - path: build/app/outputs/flutter-apk/ente.apk - - - uses: actions/upload-artifact@v2 - with: - name: release-checksum - path: build/app/outputs/flutter-apk/checksum - - # Create a Github release - - uses: ncipollo/release-action@v1 - with: - artifacts: "build/app/outputs/flutter-apk/ente.apk,build/app/outputs/flutter-apk/sha256sum" - token: ${{ secrets.GITHUB_TOKEN }}