diff --git a/.github/Dockerfile b/.github/Dockerfile index 007d1a6e..a0307b49 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -10,17 +10,14 @@ COPY . . RUN chown -R $(whoami) /app -RUN flutter pub get &&\ - flutter config --enable-linux-desktop &&\ - flutter pub get &&\ - dart run build_runner build --delete-conflicting-outputs - -RUN alias dpkg-deb="dpkg-deb --Zxz" &&\ - flutter_distributor package --platform=linux --targets=deb - +RUN flutter pub get RUN make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64 +RUN alias dpkg-deb="dpkg-deb --Zxz" &&\ + flutter_distributor package --platform=linux --targets=deb --skip-clean + + RUN mv build/spotube-linux-*-aarch64.tar.xz dist/ &&\ mv dist/**/spotube-*-linux.deb dist/Spotube-linux-aarch64.deb diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index c8594faf..1527eb18 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -36,6 +36,11 @@ jobs: dist/Spotube-linux-x86_64.deb dist/Spotube-linux-x86_64.rpm dist/spotube-linux-*-x86_64.tar.xz + - os: ubuntu-latest + platform: linux_arm + files: | + dist/Spotube-linux-aarch64.deb + dist/spotube-linux-*-aarch64.tar.xz - os: ubuntu-latest platform: android files: | @@ -70,6 +75,12 @@ jobs: java-version: '17' cache: 'gradle' check-latest: true + - name: Set up QEMU + if: ${{matrix.platform == 'linux_arm'}} + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + if: ${{matrix.platform == 'linux_arm'}} + uses: docker/setup-buildx-action@v3 - name: Install ${{matrix.platform}} dependencies run: | diff --git a/cli/commands/build/linux_arm.dart b/cli/commands/build/linux_arm.dart new file mode 100644 index 00000000..7bc8372b --- /dev/null +++ b/cli/commands/build/linux_arm.dart @@ -0,0 +1,36 @@ +import 'dart:async'; + +import 'package:args/command_runner.dart'; + +import '../../core/env.dart'; +import 'common.dart'; + +class LinuxArmBuildCommand extends Command with BuildCommandCommonSteps { + @override + String get description => "Build Linux Arm"; + + @override + String get name => "linux_arm"; + + @override + FutureOr? run() async { + await bootstrap(); + + await shell.run( + "docker buildx build --platform=linux/arm64 " + "-f .github/Dockerfile . " + "--build-arg FLUTTER_VERSION=${CliEnv.flutterVersion} " + "--build-arg BUILD_VERSION=${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber} " + "-t krtirtho/spotube_linux_arm:latest " + "--load", + ); + + await shell.run( + """ + docker images ls + docker create --name spotube_linux_arm krtirtho/spotube_linux_arm:latest + docker cp spotube_linux_arm:/app/dist/ dist/ + """, + ); + } +} diff --git a/cli/commands/install-dependencies.dart b/cli/commands/install-dependencies.dart index c7fba051..75df28df 100644 --- a/cli/commands/install-dependencies.dart +++ b/cli/commands/install-dependencies.dart @@ -17,6 +17,7 @@ class InstallDependenciesCommand extends Command { allowed: [ "windows", "linux", + "linux_arm", "macos", "ios", "android", @@ -40,6 +41,14 @@ class InstallDependenciesCommand extends Command { """, ); break; + case "linux_arm": + await shell.run( + """ + sudo apt-get update -y + sudo apt-get install -y pkg-config make python3-pip python3-setuptools + """, + ); + break; case "macos": await shell.run( """ diff --git a/cli/core/env.dart b/cli/core/env.dart index a826f9a3..33cc5df1 100644 --- a/cli/core/env.dart +++ b/cli/core/env.dart @@ -20,4 +20,5 @@ class CliEnv { static final channel = BuildChannel.fromEnvironment("CHANNEL"); static final dotenv = Platform.environment["DOTENV"]!; static final ghRunNumber = Platform.environment["GITHUB_RUN_NUMBER"]; + static final flutterVersion = Platform.environment["FLUTTER_VERSION"]!; }