Skip to content

Build Release

Build Release #22

Workflow file for this run

name: Build Release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
description: 'Version to create (e.g. 1.2.3)'
required: true
default: 'X.X.X'
type: string
build-number:
description: 'Build number to use (e.g. 123)'
required: true
type: number
jobs:
draft-release:
name: Draft v${{ inputs.version }}; build num ${{ inputs.build-number }}
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
steps:
- name: Draft release
id: draft_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
draft: true
create-build:
needs: draft-release
environment: production
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
target: [android, linux, windows]
include:
- os: ubuntu-latest
target: android
build_target: apk
build_flags: --split-per-abi
build_path: build/app/outputs/flutter-apk
- os: ubuntu-latest
target: linux
build_target: linux
build_path: build/linux/x64/release/bundle
- os: windows-latest
target: windows
build_target: windows
build_path: build\windows\x64\runner\Release
steps:
- name: Install Android dependencies
if: matrix.target == 'android'
uses: actions/setup-java@v4
with:
java-version: '17.x'
distribution: temurin
- name: Install Linux dependencies
if: matrix.target == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev libmpv-dev mpv libfuse2
wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x appimagetool
mv appimagetool /usr/local/bin/
- name: Setup Flutter
uses: subosito/flutter-action@v2
- name: Checkout code
uses: actions/checkout@v3
- name: Set version
run: |
dart pub global activate cider
cider version ${{ github.event.inputs.version }}+${{ github.event.inputs.build-number }}
- name: Configure Android Keystore
if: matrix.target == '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: |
dart run build_runner build
flutter build -v ${{ matrix.build_target }} ${{ matrix.build_flags }}
- name: Configure Android Keystore for AppBundle
if: matrix.target == 'android'
run: echo "includeNDK=true" >> key.properties
working-directory: android
- name: Build additional Flutter app for AppBundle
if: matrix.target == 'android'
run: flutter build -v appbundle
- name: Create dist directory
if: matrix.target != 'windows'
run: mkdir dist
- name: Create dist directory
if: matrix.target == 'windows'
run: md dist
- name: Rename build for Android
if: matrix.target == '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 == 'Linux'
run: tar -czf $GITHUB_WORKSPACE/dist/interstellar-linux-x86_64.tar.gz *
working-directory: ${{ matrix.build_path }}
- name: Build AppImage for Linux
if: matrix.target == 'linux'
run: |
mv ${{ matrix.build_path }}/* linux/appimage/
cp assets/icons/logo.png linux/appimage/interstellar.png
cp $(echo $(ldd -d linux/appimage/interstellar | grep -Eo ' (/usr)?/lib/[^ ]*') $(ldd -d linux/appimage/lib/libflutter_linux_gtk.so | grep -Eo ' (/usr)?/lib/[^ ]*') | tr ' ' '\n' | sort | uniq -u) linux/appimage/lib/
appimagetool linux/appimage dist/interstellar-linux-x86_64.AppImage
- name: Compress build for Windows
if: matrix.target == 'windows'
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\dist\interstellar-windows-x86_64.zip
working-directory: ${{ matrix.build_path }}
- name: Upload build to release draft
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.draft-release.outputs.upload_url }}
asset_path: dist/*