Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 98 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ on:
required: false
type: boolean
default: false
publish_mobile_stores:
description: "Upload nightly Android/iOS artifacts to Play internal/TestFlight (default-branch dispatch only)"
required: false
type: boolean
default: false

env:
# Scheduled nightly store uploads run on these UTC weekdays. Configure via
# repo variable without changing workflow logic; accepts names or ISO numbers.
NIGHTLY_MOBILE_STORE_PUBLISH_DAYS_UTC: ${{ vars.NIGHTLY_MOBILE_STORE_PUBLISH_DAYS_UTC || 'mon,thu' }}
NIGHTLY_GOOGLE_PLAY_TRACK: ${{ vars.NIGHTLY_GOOGLE_PLAY_TRACK || 'internal' }}

permissions:
contents: write
Expand All @@ -68,6 +79,7 @@ jobs:
platform: ${{ steps.meta.outputs.platform }}
linux_arch: ${{ steps.meta.outputs.linux_arch }}
is_test_run: ${{ steps.meta.outputs.is_test_run }}
publish_mobile_stores: ${{ steps.meta.outputs.publish_mobile_stores }}
smoke_enable_ip_check: ${{ steps.meta.outputs.smoke_enable_ip_check }}
steps:
- name: Checkout repo
Expand All @@ -85,6 +97,45 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
EVENT="${{ github.event_name }}"
REQUEST_MOBILE_STORE_PUBLISH="false"

normalize_publish_day() {
local day="$1"
day="${day#"${day%%[![:space:]]*}"}"
day="${day%"${day##*[![:space:]]}"}"
day="$(echo "$day" | tr '[:upper:]' '[:lower:]')"
case "$day" in
1|mon|monday) echo "1" ;;
2|tue|tues|tuesday) echo "2" ;;
3|wed|wednesday) echo "3" ;;
4|thu|thur|thurs|thursday) echo "4" ;;
5|fri|friday) echo "5" ;;
6|sat|saturday) echo "6" ;;
7|sun|sunday) echo "7" ;;
*) echo "" ;;
esac
}

is_mobile_store_publish_day() {
local today="$1"
local days="$2"
local part normalized

IFS=',' read -ra parts <<< "$days"
for part in "${parts[@]}"; do
normalized="$(normalize_publish_day "$part")"
if [[ -z "$normalized" ]]; then
echo "Error: invalid NIGHTLY_MOBILE_STORE_PUBLISH_DAYS_UTC entry '$part'" >&2
echo "Use comma-separated weekdays like 'mon,thu' or ISO weekday numbers like '1,4'." >&2
exit 1
fi
if [[ "$normalized" == "$today" ]]; then
return 0
fi
done

return 1
}

case "$EVENT" in
schedule)
Expand All @@ -94,13 +145,17 @@ jobs:
RELEASE_TAG="v${VERSION}"
PLATFORM="all"
LINUX_ARCH="all"
if is_mobile_store_publish_day "$(date -u +%u)" "$NIGHTLY_MOBILE_STORE_PUBLISH_DAYS_UTC"; then
REQUEST_MOBILE_STORE_PUBLISH="true"
fi
;;

workflow_dispatch)
# Manual trigger
BUILD_TYPE="${{ github.event.inputs.build_type }}"
PLATFORM="${{ github.event.inputs.platforms }}"
LINUX_ARCH="${{ github.event.inputs.linux_arch }}"
REQUEST_MOBILE_STORE_PUBLISH="${{ github.event.inputs.publish_mobile_stores }}"

case "$BUILD_TYPE" in
nightly)
Expand Down Expand Up @@ -182,15 +237,6 @@ jobs:
# Installer base name - Makefile will append build type
INSTALLER_BASE_NAME="lantern-installer"

echo "Build Configuration:"
echo " Event: $EVENT"
echo " Build Type: $BUILD_TYPE"
echo " Release Tag: $RELEASE_TAG"
echo " Version: $VERSION"
echo " Platform: $PLATFORM"
echo " Linux Arch: $LINUX_ARCH"
echo " Installer: $INSTALLER_BASE_NAME"

# Test run: workflow_dispatch from non-default branch
IS_TEST_RUN="false"
if [[ "$EVENT" == "workflow_dispatch" ]]; then
Expand All @@ -201,15 +247,35 @@ jobs:
fi
fi

PUBLISH_MOBILE_STORES="false"
if [[ "$BUILD_TYPE" == "nightly" && "$REQUEST_MOBILE_STORE_PUBLISH" == "true" ]]; then
if [[ "$IS_TEST_RUN" == "true" ]]; then
echo "Skipping mobile store publish for non-default-branch test run"
else
PUBLISH_MOBILE_STORES="true"
fi
fi

SMOKE_ENABLE_IP_CHECK="false"

echo "Build Configuration:"
echo " Event: $EVENT"
echo " Build Type: $BUILD_TYPE"
echo " Release Tag: $RELEASE_TAG"
echo " Version: $VERSION"
echo " Platform: $PLATFORM"
echo " Linux Arch: $LINUX_ARCH"
echo " Installer: $INSTALLER_BASE_NAME"
echo " Store Publish: $PUBLISH_MOBILE_STORES"

echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "platform=$PLATFORM" >> $GITHUB_OUTPUT
echo "linux_arch=$LINUX_ARCH" >> $GITHUB_OUTPUT
echo "installer_base_name=$INSTALLER_BASE_NAME" >> $GITHUB_OUTPUT
echo "is_test_run=$IS_TEST_RUN" >> $GITHUB_OUTPUT
echo "publish_mobile_stores=$PUBLISH_MOBILE_STORES" >> $GITHUB_OUTPUT
echo "smoke_enable_ip_check=$SMOKE_ENABLE_IP_CHECK" >> $GITHUB_OUTPUT

- name: Update pubspec.yaml version
Expand Down Expand Up @@ -670,15 +736,20 @@ jobs:
upload_if_exists "lantern-installer-pkg/${FULL_NAME}.pkg.tar.zst"
upload_if_exists "lantern-installer-ipa/${FULL_NAME}.ipa"

# Post-publish steps (only for non-nightly production/beta builds)
# Post-publish steps. Production/beta always use their release tracks; nightly
# mobile store uploads run only when set-metadata enables them.
upload-google-play:
needs: [set-metadata, build-android]
if: |
!cancelled() &&
needs.set-metadata.result == 'success' &&
needs.build-android.result == 'success' &&
(needs.set-metadata.outputs.platform == 'all' || contains(needs.set-metadata.outputs.platform, 'android')) &&
(needs.set-metadata.outputs.build_type == 'beta' || needs.set-metadata.outputs.build_type == 'production')
(
needs.set-metadata.outputs.build_type == 'beta' ||
needs.set-metadata.outputs.build_type == 'production' ||
(needs.set-metadata.outputs.build_type == 'nightly' && needs.set-metadata.outputs.publish_mobile_stores == 'true')
)
runs-on: ubuntu-latest
steps:
- name: Download AAB artifact
Expand All @@ -701,13 +772,19 @@ jobs:

- name: Pick Play track
id: track
env:
NIGHTLY_GOOGLE_PLAY_TRACK: ${{ env.NIGHTLY_GOOGLE_PLAY_TRACK }}
run: |
bt="${{ needs.set-metadata.outputs.build_type }}"
if [ "$bt" = "beta" ]; then
echo "track=beta" >> "$GITHUB_OUTPUT"
else
echo "track=production" >> "$GITHUB_OUTPUT"
fi
case "$bt" in
beta) echo "track=beta" >> "$GITHUB_OUTPUT" ;;
production) echo "track=production" >> "$GITHUB_OUTPUT" ;;
nightly) echo "track=${NIGHTLY_GOOGLE_PLAY_TRACK:-internal}" >> "$GITHUB_OUTPUT" ;;
*)
echo "Unsupported build type for Google Play upload: $bt" >&2
exit 1
;;
esac

- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1.1.3
Expand All @@ -727,7 +804,11 @@ jobs:
needs.set-metadata.result == 'success' &&
needs.build-ios.result == 'success' &&
(needs.set-metadata.outputs.platform == 'all' || contains(needs.set-metadata.outputs.platform, 'ios')) &&
(needs.set-metadata.outputs.build_type == 'beta' || needs.set-metadata.outputs.build_type == 'production')
(
needs.set-metadata.outputs.build_type == 'beta' ||
needs.set-metadata.outputs.build_type == 'production' ||
(needs.set-metadata.outputs.build_type == 'nightly' && needs.set-metadata.outputs.publish_mobile_stores == 'true')
)
runs-on: macos-14
steps:
- name: Download iOS Artifact
Expand Down
5 changes: 3 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Mar 21 10:52:49 MDT 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this

networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.9.1" apply false
id "com.android.application" version "8.13.2" apply false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should take this in a separate PR so we can test the changes.

id "org.jetbrains.kotlin.android" version "2.1.21" apply false
Comment thread
atavism marked this conversation as resolved.
}

Expand Down
Loading