Skip to content

Commit

Permalink
chore: add docker and m1 based linux arm build
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Apr 19, 2024
1 parent 9bccbc9 commit 2da5d78
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
dist
.dart_tool
.idea
32 changes: 32 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ARG FLUTTER_VERSION
ARG BUILD_VERSION

FROM --platform=arm64 fischerscode/flutter-sudo:${FLUTTER_VERSION}

WORKDIR /app

# Install dependencies
RUN sudo apt-get update &&\
sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libunwind-dev locate patchelf gir1.2-appindicator3-0.1 libappindicator3-1 libappindicator3-dev libsecret-1-0 libjsoncpp25 libsecret-1-dev libjsoncpp-dev libnotify-bin libnotify-dev mpv libmpv-dev rpm &&\
sudo rm -rf /var/lib/apt/lists/*

COPY . .

RUN sudo 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 dart pub global activate flutter_distributor &&\
alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb &&\
flutter_distributor package --platform=linux --targets=rpm


RUN make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64

RUN mv build/spotube-linux-*-aarch64.tar.xz dist/ &&\
mv dist/**/spotube-*-linux.deb dist/Spotube-linux-aarch64.deb &&\
mv dist/**/spotube-*-linux.rpm dist/Spotube-linux-aarch64.rpm
74 changes: 67 additions & 7 deletions .github/workflows/spotube-release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: |
flutter config --enable-windows-desktop
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
- name: Build Windows Executable
run: |
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
run: |
flutter config --enable-linux-desktop
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
- name: Build Linux Packages
run: |
Expand Down Expand Up @@ -206,6 +206,66 @@ jobs:
with:
limit-access-to-actor: true

linux_arm:
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- name: Install Docker
run: brew install docker

- name: Replace pubspec version and BUILD_VERSION Env (nightly)
if: ${{ inputs.channel == 'nightly' }}
run: |
brew install yq
yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV
- name: BUILD_VERSION Env (stable)
if: ${{ inputs.channel == 'stable' }}
run: |
echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Replace Version in files
run: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${{ env.BUILD_VERSION }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml
- name: Create Stable .env
if: ${{ inputs.channel == 'stable' }}
run: echo '${{ secrets.DOTENV_RELEASE }}' > .env

- name: Create Nightly .env
if: ${{ inputs.channel == 'nightly' }}
run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env

- name: Build Linux Arm
run: |
docker build -t spotube-linux-arm -f .github/Dockerfile . --build-arg BUILD_VERSION=${{ env.BUILD_VERSION }} --build-arg FLUTTER_VERSION=${{ env.FLUTTER_VERSION }}
docker create --name spotube-linux-arm spotube-linux-arm
docker cp spotube-linux-arm:/app/dist .
docker rm -f spotube-linux-arm
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: Spotube-Release-Binaries
path: |
dist/Spotube-linux-aarch64.deb
dist/Spotube-linux-aarch64.rpm
dist/spotube-linux-nightly-aarch64.tar.xz
- name: Debug With SSH When fails
if: ${{ failure() && inputs.debug && inputs.channel == 'nightly' }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true


android:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -245,7 +305,7 @@ jobs:
- name: Generate Secrets
run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
- name: Sign Apk
run: |
Expand All @@ -260,7 +320,7 @@ jobs:
- name: Build Playstore AppBundle
run: |
echo 'ENABLE_UPDATE_CHECK=0' >> .env
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
export MANIFEST=android/app/src/main/AndroidManifest.xml
xmlstarlet ed -d '//meta-data[@android:name="com.google.android.gms.car.application"]' $MANIFEST > $MANIFEST.tmp
mv $MANIFEST.tmp $MANIFEST
Expand All @@ -283,7 +343,6 @@ jobs:
limit-access-to-actor: true

macos:

runs-on: macos-14
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -317,7 +376,7 @@ jobs:
run: |
dart pub global activate flutter_distributor
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
- name: Build Macos App
run: |
Expand Down Expand Up @@ -381,7 +440,7 @@ jobs:
- name: Generate Secrets
run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
dart run build_runner build --delete-conflicting-outputs
- name: Build iOS iPA
run: |
Expand All @@ -408,6 +467,7 @@ jobs:
needs:
- windows
- linux
- linux_arm
- android
- macos
- iOS
Expand Down

0 comments on commit 2da5d78

Please sign in to comment.