diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 514e93a..7e98273 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,10 +66,15 @@ jobs: permissions: contents: write steps: + - name: Set up QEMU + uses: https://github.com/docker/setup-qemu-action@v3 + with: + platforms: arm64 + - name: Clone Main Repo run: | git clone --depth 1 https://github.com/liamcottle/reticulum-meshchat reticulum-meshchat - + - name: Get Latest Tag working-directory: ./reticulum-meshchat run: | @@ -79,34 +84,59 @@ jobs: echo "Latest tag is $LATEST_TAG" git checkout $LATEST_TAG - - name: Install NodeJS - uses: https://github.com/actions/setup-node@v3 - with: - node-version: 18 - - - name: Install Python - uses: https://github.com/actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install Python Deps - working-directory: ./reticulum-meshchat - run: pip install -r requirements.txt - - - name: Install NodeJS Deps - working-directory: ./reticulum-meshchat - run: npm install - - - name: Install Cross-Compilation Tools + - name: Setup ARM64 Build Environment run: | sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt-get install -y qemu-user-static binfmt-support + sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - name: Build Electron App for AArch64 - working-directory: ./reticulum-meshchat - run: npm run dist - env: - ELECTRON_BUILDER_ARCH: arm64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build in ARM64 Container + run: | + cat > Dockerfile << 'EOF' + FROM arm64v8/ubuntu:22.04 + + ENV DEBIAN_FRONTEND=noninteractive + + # Install dependencies + RUN apt-get update && apt-get install -y \ + git curl wget python3 python3-pip \ + build-essential libssl-dev \ + fakeroot rpm libsqlite3-dev libffi-dev \ + libx11-dev libxkbfile-dev libsecret-1-dev \ + libasound2 libnss3 libxtst6 libglib2.0-0 libgconf-2-4 + + # Install Node.js 18 + RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - + RUN apt-get install -y nodejs + + # Set up working directory + WORKDIR /app + + # Copy application code + COPY ./reticulum-meshchat /app + + # Install dependencies + RUN pip3 install -r requirements.txt + RUN npm install + + # Build the AppImage + CMD npm run dist + EOF + + docker buildx build --platform linux/arm64 -t arm64-build-env . + + # Run the build process in the container + docker run --platform linux/arm64 --rm -v $(pwd)/reticulum-meshchat:/app \ + -e ELECTRON_BUILDER_ARCH=arm64 \ + -v $(pwd)/dist:/app/dist \ + arm64-build-env + + # Copy the built artifacts + mkdir -p reticulum-meshchat/dist + cp -r dist/* reticulum-meshchat/dist/ || true - name: Create Release id: create_release