Skip to content

Build release

Build release #64

Workflow file for this run

name: Build release
permissions:
contents: write
on:
workflow_dispatch:
jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
interstellar_version: ${{ steps.build_info.outputs.INTERSTELLAR_VERSION }}
flutter_version: ${{ steps.build_info.outputs.FLUTTER_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Gather build info
id: build_info
run: |
echo "INTERSTELLAR_VERSION=$(yq -r '.version' ./pubspec.yaml | cut -d+ -f1)" >> "$GITHUB_OUTPUT"
echo "FLUTTER_VERSION=$(yq -r '.environment.flutter' ./pubspec.yaml)" >> "$GITHUB_OUTPUT"
- name: Draft v${{ steps.build_info.outputs.INTERSTELLAR_VERSION }} release
id: draft_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.build_info.outputs.INTERSTELLAR_VERSION }}
draft: true
create-build:
needs: prepare-release
environment: production
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.runner }}
container: ${{ matrix.runner_container }}
strategy:
fail-fast: false
matrix:
target: [android, linux-x86_64, linux-aarch64, windows-x86_64]
include:
- target: android
target_os: android
build_target: apk
build_flags: --split-per-abi
build_path: build/app/outputs/flutter-apk
runner: ubuntu-latest
- target: linux-x86_64
target_os: linux
target_arch: x86_64
build_target: linux
build_path: build/linux/x64/release/bundle
runner: ubuntu-24.04
runner_container: ghcr.io/pkgforge-dev/archlinux:latest
- target: linux-aarch64
target_os: linux
target_arch: aarch64
build_target: linux
build_path: build/linux/arm64/release/bundle
runner: ubuntu-24.04-arm
runner_container: ghcr.io/pkgforge-dev/archlinux:latest
- target: windows-x86_64
target_os: windows
target_arch: x86_64
build_target: windows
build_path: build\windows\x64\runner\Release
runner: windows-latest
steps:
- name: Install android dependencies
if: matrix.target_os == 'android'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: temurin
- name: Install linux dependencies
if: matrix.target_os == 'linux'
run: |
pacman -Syuq --needed --noconfirm --noprogressbar \
ninja gtk3 xz gcc mpv wget jq git which base-devel \
file zsync patchelf binutils strace mesa llvm \
xorg-server-xvfb cmake clang unzip
- name: Install windows dependencies
if: matrix.target_os == 'windows'
uses: ilammy/setup-nasm@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
# Use master until Flutter action is fixed for arm (https://github.com/subosito/flutter-action/issues/345)
channel: ${{ matrix.target == 'linux-aarch64' && 'master' || 'stable' }}
flutter-version: ${{ needs.prepare-release.outputs.flutter_version }}
# Needed to fix "detected dubious ownership in repository" error caused by Linux containerization
- name: git-config add safe directory
if: matrix.target_os == 'linux'
run: git config --global --add safe.directory $FLUTTER_ROOT
- name: Configure android Keystore
if: matrix.target_os == 'android'
run: |
echo "$ANDROID_UPLOAD_KEY" | base64 --decode > upload-keystore.jks
echo "storeFile=../upload-keystore.jks" >> key.properties
echo "keyAlias=upload" >> key.properties
echo "storePassword=$ANDROID_KEYSTORE_PASSWORD" >> key.properties
echo "keyPassword=$ANDROID_KEYSTORE_PASSWORD" >> key.properties
env:
ANDROID_UPLOAD_KEY: ${{ secrets.ANDROID_UPLOAD_KEY }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
working-directory: android
- name: Build Flutter app
run: |
flutter pub run build_runner build
flutter build -v ${{ matrix.build_target }} ${{ matrix.build_flags }}
- name: Configure android Keystore for AppBundle
if: matrix.target_os == 'android'
run: echo "includeNDK=true" >> key.properties
working-directory: android
- name: Build additional Flutter app for AppBundle
if: matrix.target_os == 'android'
run: flutter build -v appbundle
- name: Create dist directory
run: ${{ matrix.target_os == 'windows' && 'md' || 'mkdir' }} dist
- name: Rename build for android
if: matrix.target_os == 'android'
run: |
mv app-armeabi-v7a-release.apk $GITHUB_WORKSPACE/dist/interstellar-android-armeabi-v7a.apk
mv app-arm64-v8a-release.apk $GITHUB_WORKSPACE/dist/interstellar-android-arm64-v8a.apk
mv app-x86_64-release.apk $GITHUB_WORKSPACE/dist/interstellar-android-x86_64.apk
mv $GITHUB_WORKSPACE/build/app/outputs/bundle/release/app-release.aab $GITHUB_WORKSPACE/dist/interstellar-android-googleplay.aab
working-directory: ${{ matrix.build_path }}
- name: Build tar.gz for linux
if: matrix.target_os == 'linux'
run: tar -czf $GITHUB_WORKSPACE/dist/interstellar-${{ matrix.target }}.tar.gz *
working-directory: ${{ matrix.build_path }}
- name: Build AppImage for linux
if: matrix.target_os == 'linux'
run: |
EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
chmod +x ./get-debloated-pkgs.sh
./get-debloated-pkgs.sh mesa-nano gtk3-mini libxml2-mini opus-mini || true
./scripts/build-appimage.sh
- name: Compress build for windows
if: matrix.target_os == 'windows'
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\dist\interstellar-${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
- name: Create setup exe for windows
if: matrix.target_os == 'windows'
uses: Minionguyjpro/[email protected]
with:
path: scripts/build-windows-setup.iss
options: /O+
env:
INTERSTELLAR_VERSION: ${{ needs.prepare-release.outputs.interstellar_version }}
INTERSTELLAR_BUILD_PATH: ${{ github.workspace }}\${{ matrix.build_path }}
- name: Upload build to release draft
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.prepare-release.outputs.upload_url }}
asset_path: dist/*