-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 4.08 KB
/
build-linux.yml
File metadata and controls
133 lines (112 loc) · 4.08 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
name: Build Linux
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 0.9.0)'
required: true
type: string
deps_tag:
description: 'Deps release tag (e.g., deps-v1.3.0)'
required: true
type: string
arch:
description: 'Architecture'
required: false
type: choice
options:
- x64
- arm64
- both
default: x64
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-22.04
arch: x64
flutter_arch: x64
rust_target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04-arm
arch: arm64
flutter_arch: arm64
rust_target: aarch64-unknown-linux-gnu
fail-fast: false
runs-on: ${{ matrix.os }}
# Only run the job if it matches the requested arch (or both)
if: ${{ inputs.arch == 'both' || inputs.arch == matrix.arch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake git ninja-build pkg-config \
libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
worker/target/
key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-cargo-
- name: Download Linux dependencies
run: |
DEPS_VERSION="${{ inputs.deps_tag }}"
DEPS_VERSION="${DEPS_VERSION#deps-v}"
mkdir -p deps/linux-${{ matrix.arch }}
DEPS_URL="https://github.com/${{ github.repository }}/releases/download/${{ inputs.deps_tag }}/VapourBox-deps-${DEPS_VERSION}-linux-${{ matrix.arch }}.zip"
echo "Downloading deps from: $DEPS_URL"
curl -L -o deps.zip "$DEPS_URL"
unzip -o deps.zip -d deps/linux-${{ matrix.arch }}
rm -f deps.zip
echo "Dependencies extracted:"
ls -la deps/
- name: Update version numbers
run: |
VERSION="${{ inputs.version }}"
DEPS_TAG="${{ inputs.deps_tag }}"
DEPS_VERSION="${DEPS_TAG#deps-v}"
# Update pubspec.yaml
sed -i "s/^version: .*/version: ${VERSION}+1/" app/pubspec.yaml
# Update deps-version.json
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${DEPS_VERSION}\"/" app/assets/deps-version.json
sed -i "s/\"releaseTag\": \"[^\"]*\"/\"releaseTag\": \"${DEPS_TAG}\"/" app/assets/deps-version.json
# Update Cargo.toml
sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" worker/Cargo.toml
- name: Build Rust worker
run: |
cd worker
cargo build --release --target ${{ matrix.rust_target }}
# Copy to default release location for package script
mkdir -p target/release
cp target/${{ matrix.rust_target }}/release/vapourbox-worker target/release/ || true
- name: Build Flutter app
run: |
cd app
flutter pub get
dart run build_runner build --delete-conflicting-outputs
flutter build linux --release
- name: Package release
run: |
./Scripts/package-linux.sh --version "${{ inputs.version }}" --arch ${{ matrix.arch }} --skip-build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: VapourBox-${{ inputs.version }}-linux-${{ matrix.arch }}
path: dist/VapourBox-${{ inputs.version }}-linux-${{ matrix.arch }}.tar.gz