-
-
Notifications
You must be signed in to change notification settings - Fork 17
181 lines (156 loc) · 6.95 KB
/
build_release.yml
File metadata and controls
181 lines (156 loc) · 6.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build release
permissions:
contents: write
on:
workflow_dispatch:
jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
interstellar_version: ${{ steps.build_info.outputs.INTERSTELLAR_VERSION }}
flutter_version: ${{ steps.build_info.outputs.FLUTTER_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Gather build info
id: build_info
run: |
echo "INTERSTELLAR_VERSION=$(yq -r '.version' ./pubspec.yaml | cut -d+ -f1)" >> "$GITHUB_OUTPUT"
echo "FLUTTER_VERSION=$(yq -r '.environment.flutter' ./pubspec.yaml)" >> "$GITHUB_OUTPUT"
- name: Draft v${{ steps.build_info.outputs.INTERSTELLAR_VERSION }} release
id: draft_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.build_info.outputs.INTERSTELLAR_VERSION }}
draft: true
create-build:
needs: prepare-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: Checkout code
uses: actions/checkout@v4
- 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: ${{ needs.prepare-release.outputs.flutter_version }}
# 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: 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: |
EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
chmod +x ./get-debloated-pkgs.sh
./get-debloated-pkgs.sh mesa-nano gtk3-mini libxml2-mini opus-mini || true
./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.7
with:
path: scripts/build-windows-setup.iss
options: /O+
env:
INTERSTELLAR_VERSION: ${{ needs.prepare-release.outputs.interstellar_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.prepare-release.outputs.upload_url }}
asset_path: dist/*