Build release #47
This file contains hidden or 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 | |
| build-number: | |
| description: 'Build number to use (e.g. 65)' | |
| 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.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: 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: 3.29.3 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 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: Set version | |
| run: | | |
| flutter pub global activate cider | |
| cider version ${{ github.event.inputs.version }}+${{ github.event.inputs.build-number }} | |
| - 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: | | |
| PKG_URL_PREFIX="https://github.com/pkgforge-dev/llvm-libs-debloated/releases/download/continuous" | |
| case "$(uname -m)" in | |
| "x86_64") | |
| PKG_URL_SUFFIX="x86_64.pkg.tar.zst" | |
| ;; | |
| "aarch64") | |
| PKG_URL_SUFFIX="aarch64.pkg.tar.xz" | |
| ;; | |
| *) | |
| echo "Unsupported ARCH: '${ARCH}'" | |
| exit 1 | |
| ;; | |
| esac | |
| wget "${PKG_URL_PREFIX}/llvm-libs-nano-${PKG_URL_SUFFIX}" -O /tmp/llvm-libs.pkg.tar.zst | |
| wget "${PKG_URL_PREFIX}/libxml2-iculess-${PKG_URL_SUFFIX}" -O /tmp/libxml2.pkg.tar.zst | |
| wget "${PKG_URL_PREFIX}/ffmpeg-mini-${PKG_URL_SUFFIX}" -O /tmp/ffmpeg-mini.pkg.tar.zst | |
| pacman -U --noconfirm /tmp/*.pkg.tar.zst | |
| pacman -Scc --noconfirm | |
| rm -rf /tmp/*.pkg.tar.zst | |
| ./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/Inno-Setup-Action@v1.2.5 | |
| with: | |
| path: scripts/build-windows-setup.iss | |
| options: /O+ | |
| env: | |
| INTERSTELLAR_VERSION: ${{ github.event.inputs.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.draft-release.outputs.upload_url }} | |
| asset_path: dist/* |