Skip to content

Build and upload assets #16

Build and upload assets

Build and upload assets #16

Workflow file for this run

name: Build and upload assets
on:
release:
types: [published]
jobs:
build-linux-android:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update packages
run: sudo apt-get update && sudo apt-get upgrade -y
- name: Install system libraries
run: sudo apt-get install -y build-essential libgtk-3-dev libblkid-dev liblzma-dev ninja-build pkg-config libsecret-1-dev
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.24.0
- run: flutter --version
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Get dependencies
run: flutter pub get
- name: Run code generation
run: dart run build_runner build
- name: Decode keystore & build Android
env:
SIGNING_KEYSTORE: "keystore.jks"
SIGNING_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
echo "${{ secrets.SIGNING_KEYSTORE }}" | base64 --decode > android/app/keystore.jks
# build Android APK with ABI splits
flutter build apk --release --split-per-abi
# build universal Android APK
flutter build apk --release
# 'bin' directory to store and upload the renamed APKs
mkdir bin
# Rename output APKs with Release Tag
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-arm64-v8a-release.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-armeabi-v7a-release.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-x86_64-release.apk
# Rename Universal APK with Release Tag
mv build/app/outputs/flutter-apk/app-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-universal.apk
- name: Build Linux app
run: |
flutter build linux --release
# create a tar.gz archive with all necessary files
tar -czvf spectrum-${{ github.event.release.tag_name }}-linux.tar.gz -C build/linux/x64/release/bundle .
mv spectrum-${{ github.event.release.tag_name }}-linux.tar.gz bin/
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
bin/*.apk
bin/spectrum-${{ github.event.release.tag_name }}-linux.tar.gz
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.24.0
- run: flutter --version
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Get dependencies
run: flutter pub get
- name: Run code generation
run: dart run build_runner build
- name: Build Windows app
run: |
flutter build windows --release
# Build MSIX Packaging
dart run msix:create
# 'winbin' directory
mkdir winbin
# create a tar.gz archive with all necessary files
powershell Compress-Archive -Path build/windows/x64/runner/Release -DestinationPath winbin/spectrum-${{ github.event.release.tag_name }}-windows.zip
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: winbin/*.zip