206 lines
6.9 KiB
YAML
206 lines
6.9 KiB
YAML
|
name: Release
|
||
|
|
||
|
on:
|
||
|
workflow_dispatch:
|
||
|
|
||
|
env:
|
||
|
go_version: '1.16'
|
||
|
flutter_channel: 'stable'
|
||
|
flutter_version: '2.10.3'
|
||
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||
|
|
||
|
jobs:
|
||
|
|
||
|
ci-pass:
|
||
|
name: CI is green
|
||
|
runs-on: ubuntu-latest
|
||
|
needs:
|
||
|
- check_release
|
||
|
- build_release_assets
|
||
|
steps:
|
||
|
- run: exit 0
|
||
|
|
||
|
check_release:
|
||
|
name: Check release
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
with:
|
||
|
repository: ${{ github.event.inputs.repo }}
|
||
|
ref: 'master'
|
||
|
- name: Checkout submodules
|
||
|
run: git submodule update --init --recursive
|
||
|
- uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ${{ env.go_version }}
|
||
|
- name: Check release
|
||
|
run: |
|
||
|
cd ci
|
||
|
go run ./cmd/check_release
|
||
|
|
||
|
build_release_assets:
|
||
|
name: Build release assets
|
||
|
needs:
|
||
|
- check_release
|
||
|
strategy:
|
||
|
fail-fast: false
|
||
|
matrix:
|
||
|
config:
|
||
|
- target: linux
|
||
|
host: ubuntu-latest
|
||
|
- target: windows
|
||
|
host: windows-latest
|
||
|
- target: macos
|
||
|
host: macos-latest
|
||
|
- target: ios
|
||
|
host: macos-latest
|
||
|
- target: android-arm32
|
||
|
host: ubuntu-latest
|
||
|
- target: android-arm64
|
||
|
host: ubuntu-latest
|
||
|
- target: android-x86_64
|
||
|
host: ubuntu-latest
|
||
|
|
||
|
runs-on: ${{ matrix.config.host }}
|
||
|
|
||
|
env:
|
||
|
TARGET: ${{ matrix.config.target }}
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v3
|
||
|
|
||
|
- name: Setup golang
|
||
|
uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ${{ env.go_version }}
|
||
|
|
||
|
- id: check_asset
|
||
|
name: Check asset
|
||
|
run: |
|
||
|
cd ci
|
||
|
go run ./cmd/check_asset
|
||
|
|
||
|
- name: Setup flutter
|
||
|
if: steps.check_asset.outputs.skip_build != 'true'
|
||
|
uses: subosito/flutter-action@v2.3.0
|
||
|
with:
|
||
|
channel: ${{ env.flutter_channel }}
|
||
|
flutter-version: ${{ env.flutter_version }}
|
||
|
|
||
|
- name: Setup java (Android)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
|
||
|
uses: actions/setup-java@v3
|
||
|
with:
|
||
|
java-version: 8
|
||
|
distribution: 'zulu'
|
||
|
|
||
|
- name: Setup android tools (Android)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
|
||
|
uses: maxim-lobanov/setup-android-tools@v1
|
||
|
with:
|
||
|
packages: |
|
||
|
platform-tools
|
||
|
platforms;android-32
|
||
|
build-tools;30.0.2
|
||
|
ndk;22.1.7171670
|
||
|
|
||
|
- name: Setup msys2 (Windows)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'windows'
|
||
|
uses: msys2/setup-msys2@v2
|
||
|
with:
|
||
|
install: gcc make
|
||
|
|
||
|
- name: Install dependencies (Linux)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'linux'
|
||
|
env:
|
||
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||
|
run: |
|
||
|
curl -JOL https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||
|
chmod a+x appimagetool-x86_64.AppImage
|
||
|
mkdir -p ${GITHUB_WORKSPACE}/bin
|
||
|
mv appimagetool-x86_64.AppImage ${GITHUB_WORKSPACE}/bin/appimagetool
|
||
|
echo ::add-path::${GITHUB_WORKSPACE}/bin
|
||
|
sudo apt-get update
|
||
|
sudo apt-get install -y libgl1-mesa-dev xorg-dev
|
||
|
|
||
|
- name: Install hover (desktop)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'linux' || matrix.config.target == 'windows' || matrix.config.target == 'macos')
|
||
|
run: |
|
||
|
go install github.com/go-flutter-desktop/hover@latest
|
||
|
|
||
|
- name: Install go mobile (mobile)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'ios' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-arm32' || matrix.config.target == 'android-x86_64' )
|
||
|
run: |
|
||
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
||
|
|
||
|
- name: Set-Version (All)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true'
|
||
|
run: |
|
||
|
cd ci
|
||
|
cp version.code.txt ../lib/assets/version.txt
|
||
|
|
||
|
- name: Build (windows)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'windows'
|
||
|
run: |
|
||
|
hover build windows
|
||
|
cd go\build\outputs\windows-release
|
||
|
DEL flutter_engine.pdb
|
||
|
DEL flutter_engine.exp
|
||
|
DEL flutter_engine.lib
|
||
|
Compress-Archive * ../../../../build/build.zip
|
||
|
|
||
|
- name: Build (macos)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'macos'
|
||
|
run: |
|
||
|
hover build darwin-dmg
|
||
|
mv go/build/outputs/darwin-dmg-release/*.dmg build/build.dmg
|
||
|
|
||
|
- name: Build (linux)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'linux'
|
||
|
run: |
|
||
|
curl -JOL https://github.com/junmer/source-han-serif-ttf/raw/master/SubsetTTF/CN/SourceHanSerifCN-Regular.ttf
|
||
|
mkdir -p fonts
|
||
|
mv SourceHanSerifCN-Regular.ttf fonts/Roboto.ttf
|
||
|
cat ci/linux_font.yaml >> pubspec.yaml
|
||
|
hover build linux-appimage
|
||
|
mv go/build/outputs/linux-appimage-release/*.AppImage build/build.AppImage
|
||
|
|
||
|
- name: Build (ios)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'ios'
|
||
|
run: |
|
||
|
sh scripts/build-ipa.sh
|
||
|
|
||
|
- name: Build (android-arm32)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'android-arm32'
|
||
|
run: |
|
||
|
sh scripts/build-apk-arm.sh
|
||
|
|
||
|
- name: Build (android-arm64)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'android-arm64'
|
||
|
run: |
|
||
|
sh scripts/build-apk-arm64.sh
|
||
|
|
||
|
- name: Build (android-x86_64)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'android-x86_64'
|
||
|
run: |
|
||
|
sh scripts/build-apk-x64.sh
|
||
|
|
||
|
- name: Sign APK (Android)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
|
||
|
uses: r0adkll/sign-android-release@v1
|
||
|
id: sign_app
|
||
|
with:
|
||
|
releaseDirectory: build/app/outputs/flutter-apk
|
||
|
signingKeyBase64: ${{ secrets.SIGN_FILE_BASE64 }}
|
||
|
alias: ${{ secrets.KEY_ALIAS }}
|
||
|
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
|
||
|
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||
|
|
||
|
- name: Upload Asset (All)
|
||
|
if: steps.check_asset.outputs.skip_build != 'true'
|
||
|
run: |
|
||
|
cd ci
|
||
|
go run ./cmd/upload_asset
|
||
|
|