172 lines
5.4 KiB
YAML
172 lines
5.4 KiB
YAML
name: Build Linux AppImages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build_linux_amd64:
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- 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: |
|
|
git fetch --tags --quiet https://github.com/liamcottle/reticulum-meshchat
|
|
LATEST_TAG=$(git describe --tags --abbrev=0)
|
|
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
|
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: Build Electron App for AMD64
|
|
working-directory: ./reticulum-meshchat
|
|
run: npm run dist
|
|
env:
|
|
ELECTRON_BUILDER_ARCH: x64
|
|
|
|
- name: Rename AppImage with AMD64 Label
|
|
run: |
|
|
for file in reticulum-meshchat/dist/*.AppImage; do
|
|
FILENAME=$(basename "$file")
|
|
NAME_WITHOUT_EXT="${FILENAME%.AppImage}"
|
|
mv "$file" "reticulum-meshchat/dist/${NAME_WITHOUT_EXT}-amd64.AppImage"
|
|
done
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: https://github.com/ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.LATEST_TAG }}
|
|
name: ${{ env.LATEST_TAG }}
|
|
draft: true
|
|
allowUpdates: true
|
|
replacesArtifacts: true
|
|
omitDraftDuringUpdate: true
|
|
omitNameDuringUpdate: true
|
|
artifacts: "reticulum-meshchat/dist/*-amd64-linux.AppImage"
|
|
|
|
build_linux_aarch64:
|
|
runs-on: ubuntu-22.04
|
|
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: |
|
|
git fetch --tags --quiet https://github.com/liamcottle/reticulum-meshchat
|
|
LATEST_TAG=$(git describe --tags --abbrev=0)
|
|
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
|
echo "Latest tag is $LATEST_TAG"
|
|
git checkout $LATEST_TAG
|
|
|
|
- name: Setup ARM64 Build Environment
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y qemu-user-static binfmt-support
|
|
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
|
|
- 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: Rename AppImage with ARM64 Label
|
|
run: |
|
|
mkdir -p reticulum-meshchat/dist
|
|
for file in output/*.AppImage; do
|
|
if [ -f "$file" ]; then
|
|
FILENAME=$(basename "$file")
|
|
NAME_WITHOUT_EXT="${FILENAME%.AppImage}"
|
|
cp "$file" "reticulum-meshchat/dist/${NAME_WITHOUT_EXT}-arm64.AppImage"
|
|
fi
|
|
done
|
|
ls -la reticulum-meshchat/dist/
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: https://github.com/ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.LATEST_TAG }}
|
|
name: ${{ env.LATEST_TAG }}
|
|
draft: true
|
|
allowUpdates: true
|
|
replacesArtifacts: true
|
|
omitDraftDuringUpdate: true
|
|
omitNameDuringUpdate: true
|
|
artifacts: "reticulum-meshchat/dist/*-arm64-linux.AppImage"
|