Skip to content

Internal release (photos) #122

Internal release (photos)

Internal release (photos) #122

name: "Internal release (photos)"
on:
schedule:
# Runs daily at 12:30 UTC (6:00 PM IST)
- cron: "30 12 * * *"
workflow_dispatch: # Allow manual trigger
env:
FLUTTER_VERSION: "3.32.8"
RUST_VERSION: "1.86.0"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: mobile/apps/photos
steps:
- name: Checkout code and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Free up disk space
run: |
echo "Initial disk usage:"
df -h /
# Get available space in KB
INITIAL=$(df / | awk 'NR==2 {print $4}')
echo -e "\n=== Removing .NET SDK (~20-25GB) ==="
BEFORE=$(df / | awk 'NR==2 {print $4}')
START=$(date +%s)
sudo rm -rf /usr/share/dotnet
END=$(date +%s)
AFTER=$(df / | awk 'NR==2 {print $4}')
FREED=$(( (AFTER - BEFORE) / 1048576 )) # Convert KB to GB
echo "Time: $((END-START))s | Freed: ${FREED}GB"
echo -e "\n=== Removing cached tools (~5-10GB) ==="
BEFORE=$(df / | awk 'NR==2 {print $4}')
START=$(date +%s)
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
END=$(date +%s)
AFTER=$(df / | awk 'NR==2 {print $4}')
FREED=$(( (AFTER - BEFORE) / 1048576 ))
echo "Time: $((END-START))s | Freed: ${FREED}GB"
echo -e "\n=== Final Summary ==="
FINAL=$(df / | awk 'NR==2 {print $4}')
TOTAL_FREED=$(( (FINAL - INITIAL) / 1048576 ))
echo "Total space freed: ${TOTAL_FREED}GB"
echo "Final disk usage:"
df -h /
- name: Setup JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Install Flutter ${{ env.FLUTTER_VERSION }}
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install Flutter Rust Bridge
run: cargo install flutter_rust_bridge_codegen
- name: Generate Rust bindings
run: flutter_rust_bridge_codegen generate
- name: Increment version code for build
run: |
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
VERSION_NAME=$(echo $CURRENT_VERSION | cut -d'+' -f1)
CURRENT_BUILD=$(echo $CURRENT_VERSION | cut -d'+' -f2)
NEW_VERSION_CODE=$((CURRENT_BUILD + ${{ github.run_number }}))
NEW_VERSION="${VERSION_NAME}+${NEW_VERSION_CODE}"
sed -i "s/^version: .*/version: $NEW_VERSION/" pubspec.yaml
echo "Building with version ${NEW_VERSION}"
# Store version for later use
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
echo "NEW_VERSION_CODE=${NEW_VERSION_CODE}" >> $GITHUB_ENV
- name: Prepare and validate changelog for Play Store
run: |
mkdir -p whatsnew
CHANGELOG_FILE="scripts/store_changes.txt"
DISCORD_FILE="scripts/internal_changes.txt"
OUTPUT_FILE="whatsnew/whatsnew-en-US"
# Use provided changelog or fallback
if [ -f "$CHANGELOG_FILE" ]; then
head -c 500 "$CHANGELOG_FILE" > "$OUTPUT_FILE"
else
echo "Bug fixes and improvements" > "$OUTPUT_FILE"
fi
# Validate: file exists
if [ ! -s "$OUTPUT_FILE" ]; then
echo "❌ Changelog is empty."
exit 1
fi
# Validate: <= 500 chars
LENGTH=$(wc -m < "$OUTPUT_FILE")
if [ "$LENGTH" -gt 500 ]; then
echo "❌ Changelog exceeds 500 characters ($LENGTH)."
exit 1
fi
# Validate: no markdown or HTML
if grep -Eq '[\*\_\<\>\[\]\(\)]' "$OUTPUT_FILE"; then
echo "❌ Changelog contains markdown/HTML formatting."
exit 1
fi
echo "✅ Changelog valid:"
cat "$OUTPUT_FILE"
# Store changelog for Play Store (with escaped newlines)
CHANGELOG_PLAYSTORE=$(cat "$OUTPUT_FILE" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')
echo "CHANGELOG=${CHANGELOG_PLAYSTORE}" >> $GITHUB_ENV
# Store changelog for Discord (with proper newlines)
CHANGELOG_DISCORD=$(cat "$DISCORD_FILE" | sed 's/"/\\"/g')
echo "CHANGELOG_DISCORD<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG_DISCORD" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Setup keys
uses: timheuer/base64-to-file@v1
with:
fileName: "keystore/ente_photos_key.jks"
encodedString: ${{ secrets.SIGNING_KEY_PHOTOS }}
- name: Build PlayStore AAB
run: |
flutter build appbundle --dart-define=cronetHttpNoPlay=true --release --flavor playstore
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: Upload AAB to PlayStore
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: io.ente.photos
releaseFiles: mobile/apps/photos/build/app/outputs/bundle/playstoreRelease/app-playstore-release.aab
track: internal
whatsNewDirectory: mobile/apps/photos/whatsnew
mappingFile: mobile/apps/photos/build/app/outputs/mapping/playstoreRelease/mapping.txt
- name: Notify Discord
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_INTERNAL_RELEASE_WEBHOOK }}
nodetail: true
title: "🏆 Daily release Photos v${{ env.NEW_VERSION }} (Branch: ${{ github.ref_name }})"
description: |
**Version:** ${{ env.NEW_VERSION }}
**Flutter:** ${{ env.FLUTTER_VERSION }}
**Commit:** [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
**Download:** [Play Store](https://play.google.com/store/apps/details?id=io.ente.photos)
**Sentry:** [Exceptions](https://sentry.ente.io/organizations/ente/issues/?environment=production&project=2&query=release.build%3A%3E%3D${{ env.NEW_VERSION_CODE }}&referrer=issue-list&statsPeriod=7d)
**Changes:**
${{ env.CHANGELOG_DISCORD }}
color: 0x00ff00