-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (121 loc) · 4.13 KB
/
build-and-release.yml
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
name: Build and Release Flutter Packages
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [linux, windows, macos, android, ios]
arch: [x64, arm64]
exclude:
- platform: windows
arch: arm64
- platform: ios
arch: x64 # Exclude iOS x64
- platform: android
arch: x64 # Exclude android x64
include:
- platform: macos
arch: arm64
- platform: macos
arch: x64
- platform: linux
arch: arm64
- platform: linux
arch: x64
- platform: windows
arch: x64
- platform: ios
arch: arm64
- platform: android
arch: arm64
runs-on: ${{ matrix.platform == 'macos' || matrix.platform == 'ios' ? 'macos-latest' : matrix.platform == 'windows' ? 'windows-latest' : 'ubuntu-latest' }}
env:
PLATFORM: ${{ matrix.platform }}
ARCH: ${{ matrix.arch }}
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Set up Flutter environment
if: ${{ matrix.platform != 'macos' && matrix.platform != 'ios' }}
run: |
sudo apt-get update
sudo apt-get install -y curl unzip xz-utils libglu1-mesa
curl -o flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.7.0-stable.tar.xz
tar xf flutter.tar.xz
export PATH="$PATH:$PWD/flutter/bin"
flutter doctor
- name: Set up Flutter environment for macOS
if: ${{ matrix.platform == 'macos' || matrix.platform == 'ios' }}
run: |
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Set Homebrew path based on architecture
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" # For Apple Silicon
else
eval "$(/usr/local/bin/brew shellenv)" # For Intel
fi
# Install Flutter
brew install --cask flutter
# Set PATH and check Flutter installation
export PATH="$PATH:/Users/runner/Library/Flutter/bin"
flutter doctor
- name: Show workflow information
run: |
echo "Platform: $PLATFORM, Architecture: $ARCH"
- name: Build Flutter packages
run: |
case $PLATFORM in
linux)
flutter build linux --release --target-arch=$ARCH
;;
windows)
flutter build windows --release --target-arch=$ARCH
;;
macos)
flutter build macos --release
flutter build ios --release --no-codesign
;;
android)
flutter build apk --release
;;
ios)
flutter build ios --release --no-codesign
;;
esac
- name: List built files
run: ls -R build
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}-${{ github.run_id }}
release_name: Release v${{ github.run_number }}-${{ github.run_id }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload built packages to Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.run_number }}-${{ github.run_id }}
files: |
build/linux/x64/release/bundle/*
build/linux/arm64/release/bundle/*
build/windows/runner/Release/XStream.exe
build/macos/Build/Products/Release/XStream.app
build/app/outputs/flutter-apk/app-release.apk
# If you have an iOS build:
# build/ios/iphoneos/XStream.app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}