Skip to content

v1.1.5

v1.1.5 #14

Workflow file for this run

name: FxFiles Android Deploy
on:
workflow_dispatch:
release:
types: [published]
jobs:
deploy-android:
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
run: |
echo "Disk space before cleanup:"
df -h
# Remove unused software to free up space
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/share/swift
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
# Remove Docker images
sudo docker image prune --all --force || true
# Clean apt cache
sudo apt-get clean
echo "Disk space after cleanup:"
df -h
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.5'
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- name: Flutter Doctor
run: flutter doctor -v
- name: Get Dependencies
run: flutter pub get
- name: Get Package Version
run: |
VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //' | tr -d ' ')
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
echo "App version: $VERSION"
- name: Decode Keystore
run: echo "${{ secrets.SIGNING_KEY_BASE64 }}" | base64 -d > ${{ github.workspace }}/android/app/signingKey.jks
- name: Create key.properties
run: |
echo "storePassword=${{ secrets.KEY_STORE_PASSWORD }}" > ${{ github.workspace }}/android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> ${{ github.workspace }}/android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> ${{ github.workspace }}/android/key.properties
echo "storeFile=${{ github.workspace }}/android/app/signingKey.jks" >> ${{ github.workspace }}/android/key.properties
- name: Build Android App Bundle
run: flutter build appbundle --release
- name: List Build Output
run: ls -la ${{ github.workspace }}/build/app/outputs/bundle/release/
- name: Get Release Info
id: get-release-info
uses: actions/github-script@v5
with:
script: |
let releaseId = 0;
try {
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
});
releaseId = release.data.id;
} catch (error) {
console.log('Error fetching latest release: ', error.message);
}
return releaseId;
- name: Print Release ID
run: echo "Release ID is ${{ steps.get-release-info.outputs.result }}"
- name: Upload AAB to Release
uses: actions/github-script@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const fs = require('fs');
const path = require('path');
const directory = '${{ github.workspace }}/build/app/outputs/bundle/release';
const files = fs.readdirSync(directory);
for (const file of files) {
if (file.endsWith('.aab')) {
const filePath = path.join(directory, file);
console.log(`Uploading ${file}...`);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ steps.get-release-info.outputs.result }},
name: `FxFiles_v${{ env.APP_VERSION }}_${file}`,
data: fs.readFileSync(filePath)
});
}
}
# Optional: Upload to Google Play using Fastlane or r0adkll/upload-google-play
# - name: Upload to Google Play
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
# packageName: land.fx.files
# releaseFiles: build/app/outputs/bundle/release/app-release.aab
# track: internal
# status: completed