Add mobile release workflow (#684)

## Description

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

## Tests

Currently untested.
This commit is contained in:
Manav Rathi 2024-03-06 09:11:01 +05:30 committed by GitHub
commit 3a0dc05e3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 91 additions and 167 deletions

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

56
.github/workflows/mobile-release.yml vendored Normal file
View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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 }}