Skip to content

Manual Build App

Manual Build App #272

Workflow file for this run

name: Manual Build App
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
flutter_channel:
description: "run with flutter channel, eg: master, beta, stable"
required: true
default: "master"
push:
tags:
- 'v*'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
# Work around https://github.com/actions/runner-images/issues/8659
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8
with:
os: ubuntu-latest
- run: g++ --version
- run: gcc --version
- run: sudo apt-get install libstdc++6
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: ${{ github.event.inputs.flutter_channel || 'master' }} # 'master', 'beta', 'dev' or 'stable'
- uses: actions-rs/toolchain@v1
with:
toolchain: 'stable' # 'stable' or 'nightly'
override: true
components: rustfmt, clippy
# flutter build need ninja.
# https://github.com/subosito/flutter-action/issues/49
- name: Patch for linux build
run: |
flutter doctor
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
sudo apt-get install libsdl2-dev
sudo apt-get install webkit2gtk-4.1
sudo apt-get install libopus-dev libogg-dev
flutter doctor
- run: flutter --version
- run: flutter config --enable-linux-desktop
# setup webcrypto for unit test
- run: dart run webcrypto:setup
- name: Run tests
run: flutter test
- name: Build APP
run: flutter build linux
- name: Compress Flutter build
run: tar -C build/linux/x64/release/bundle -cvf mixin-desktop-linux-portable.tar.gz .
- name: Upload app archive for next steps
uses: actions/upload-artifact@v3
with:
name: mixin-desktop-linux-portable-archive
path: mixin-desktop-linux-portable.tar.gz
- name: Package APP
run: ./dist/linux_deb.sh
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: mixin_desktop_amd64.deb.zip
path: build/mixin_desktop_amd64.deb
- name: upload linux binary
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: mixin-desktop-linux-portable.tar.gz
asset_name: mixin_desktop_linux_amd64_portable.tar.gz
tag: ${{ github.ref }}
overwrite: true
- name: upload linux deb
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/mixin_desktop_amd64.deb
asset_name: mixin_desktop_linux_amd64.deb
tag: ${{ github.ref }}
overwrite: true
build-linux-snap:
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download app archive
uses: actions/download-artifact@v3
with:
name: mixin-desktop-linux-portable-archive
- name: uncompress app archive
run: |
mkdir -p build/linux/x64/release/bundle
tar -C build/linux/x64/release/bundle -xvf mixin-desktop-linux-portable.tar.gz
- name: Prepare snap build
run: ./dist/linux_snap_prepare.sh
- name: Build .snap
uses: snapcore/action-build@v1
id: build-snap
with:
snapcraft-args: '--enable-experimental-extensions'
path: dist/snap
- name: Upload snap
uses: actions/upload-artifact@v3
with:
name: mixin-desktop-snap
path: ${{ steps.build-snap.outputs.snap }}
- name: Upload linux snap
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.build-snap.outputs.snap }}
asset_name: mixin_desktop_linux_amd64.snap
tag: ${{ github.ref }}
overwrite: true
build-linux-appimage:
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download app archive
uses: actions/download-artifact@v3
with:
name: mixin-desktop-linux-portable-archive
- name: uncompress app archive
run: |
mkdir -p build/linux/x64/release/bundle
tar -C build/linux/x64/release/bundle -xvf mixin-desktop-linux-portable.tar.gz
- name: Build AppImage unsing appimage-builder
uses: docker://appimagecrafters/appimage-builder:0.9.1
with:
entrypoint: appimage-builder
args: --recipe ./AppImageBuilder.yml --skip-test
- name: Upload AppImage Artifact
uses: actions/upload-artifact@v3
with:
name: AppImage
path: './*.AppImage*'
- name: Upload linux AppImage
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Mixin Messenger-latest-x86_64.AppImage
asset_name: mixin_desktop_linux_amd64.AppImage
tag: ${{ github.ref }}
overwrite: true
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: ${{ github.event.inputs.flutter_channel || 'master' }}
- uses: actions-rs/toolchain@v1
with:
toolchain: 'stable' # 'stable' or 'nightly'
override: true
components: rustfmt, clippy
- run: flutter --version
# https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows/22575737#22575737
- run: git config --system core.longpaths true
- run: flutter config --enable-windows-desktop
# fix error when dump debug info: (msdia*.dll unregistered?)
- run: regsvr32 "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Remote Debugger\x64\msdia140.dll"
- uses: ilammy/setup-nasm@v1
# setup webcrypto for unit test
# - run: flutter pub run webcrypto:setup
#
# - name: Run tests
# run: flutter test
- name: Build APP
id: build-app
run: |
$version_str=$(gc .\pubspec.yaml | select-string '(?<=^version: ).*' -AllMatches | Select-Object -Expand Matches | %{$_.Value})
$version=$version_str.Split("+")[0]
$build_number=$version_str.Split("+")[1]
flutter build windows --dart-define="APP_VERSION=$version" --dart-define="APP_BUILD_NUMBER=$build_number" -vv
echo "MSIX_PACKAGE_VERSION=$version.0" >> $Env:GITHUB_OUTPUT
- name: Build Installer
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "windows_inno_setup.iss"
shell: cmd
- name: Upload Installer
uses: actions/upload-artifact@v3
with:
name: mixin_setup.exe.zip
path: build\mixin_setup.exe
- name: Build msix
run: |
echo "create msix. version: ${{ steps.build-app.outputs.MSIX_PACKAGE_VERSION }}"
flutter pub run msix:create --build-windows false --version ${{ steps.build-app.outputs.MSIX_PACKAGE_VERSION }} -v
- name: Upload msix
uses: actions/upload-artifact@v3
with:
name: flutter_app.msix.zip
path: build\windows\x64\runner\Release\flutter_app.msix
- name: collect debug info
run: flutter pub run debug_info_collector
- name: Upload debug info
uses: actions/upload-artifact@v3
with:
name: windows_debug_info
path: build\syms
- name: Upload windows setup exe
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/mixin_setup.exe
asset_name: mixin_desktop_windows_setup_amd64.exe
tag: ${{ github.ref }}
overwrite: true