Build Release #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
jobs: | |
draft-release: | |
name: Draft release v${{ inputs.version }} | |
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@v1 | |
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, ios, linux, macos, windows] | |
include: | |
- os: ubuntu-latest | |
target: android | |
build_target: apk | |
build_flags: --split-per-abi | |
build_path: build/app/outputs/flutter-apk | |
- os: macos-latest | |
target: ios | |
build_target: ios | |
build_flags: --no-codesign | |
build_path: build/ios | |
- os: ubuntu-latest | |
target: linux | |
build_target: linux | |
build_path: build/linux/x64/release/bundle | |
- os: macos-latest | |
target: macos | |
build_target: macos | |
build_path: build/macos/Build/Products/Release | |
- 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 }} | |
- 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: 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 | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for iOS | |
if: matrix.target == 'ios' | |
run: | | |
mv iphoneos Payload | |
ditto -c -k --sequesterRsrc --keepParent Payload $GITHUB_WORKSPACE/dist/interstellar-ios.ipa | |
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 macOS | |
if: matrix.target == 'macOS' | |
run: ditto -c -k --sequesterRsrc --keepParent interstellar.app $GITHUB_WORKSPACE/dist/interstellar-macos.zip | |
working-directory: ${{ matrix.build_path }} | |
- 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/* |