Skip to content

Commit

Permalink
Add mobile release workflow (#684)
Browse files Browse the repository at this point in the history
## Description

Resurrect the existing mobile independent release GitHub workflow,
adapting it to the new monorepo structure but otherwise keeping it
unchanged.

## Tests

Currently untested.
  • Loading branch information
mnvr authored Mar 6, 2024
2 parents 946a78a + 36d5aa9 commit 3a0dc05
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 167 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/auth-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- "auth/**"
- ".github/workflows/auth-lint.yml"

env:
FLUTTER_VERSION: "3.16.9"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -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
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/auth-release.yml
Original file line number Diff line number Diff line change
@@ -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:
#
Expand Down Expand Up @@ -38,7 +37,6 @@ jobs:

defaults:
run:
# Run all the "run" steps inside the auth directory
working-directory: auth

steps:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -135,7 +133,6 @@ jobs:

defaults:
run:
# Run all the "run" steps inside the auth directory
working-directory: auth

steps:
Expand Down Expand Up @@ -189,7 +186,6 @@ jobs:
uses: ncipollo/release-action@v1
with:
artifacts: "auth/artifacts/*"
prerelease: true
draft: true
allowUpdates: true
updateOnlyUnreleased: true
Expand All @@ -199,7 +195,6 @@ jobs:

defaults:
run:
# Run all the "run" steps inside the auth directory
working-directory: auth

steps:
Expand Down Expand Up @@ -291,7 +286,6 @@ jobs:
uses: ncipollo/release-action@v1
with:
artifacts: "auth/artifacts/*"
prerelease: true
draft: true
allowUpdates: true
updateOnlyUnreleased: true
3 changes: 2 additions & 1 deletion .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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*"

Expand All @@ -17,7 +19,6 @@ jobs:
- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
prerelease: true
draft: true

build:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/mobile-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- "mobile/**"
- ".github/workflows/mobile-lint.yml"

env:
FLUTTER_VERSION: "3.13.4"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -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
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/mobile-release.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 16 additions & 14 deletions auth/docs/release.md
Original file line number Diff line number Diff line change
@@ -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.
65 changes: 0 additions & 65 deletions mobile/.github/workflows/build.yml

This file was deleted.

70 changes: 0 additions & 70 deletions mobile/.github/workflows/release.yml

This file was deleted.

0 comments on commit 3a0dc05

Please sign in to comment.