name: Build and Release on: push: tags: - "*" workflow_dispatch: inputs: # build_windows: # description: "Build Windows" # required: false # default: "true" # type: boolean # build_mac: # description: "Build macOS" # required: false # default: "true" # type: boolean build_linux: description: "Build Linux" required: false default: "true" type: boolean build_docker: description: "Build Docker" required: false default: "true" type: boolean permissions: contents: read jobs: build_frontend: runs-on: ubuntu-latest permissions: contents: read steps: - name: Clone Repo uses: https://git.quad4.io/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Install NodeJS uses: https://git.quad4.io/actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version: 22 - name: Install Python uses: https://git.quad4.io/actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: "3.13" - name: Sync versions run: python scripts/sync_version.py - name: Install pnpm uses: https://git.quad4.io/actions/setup-pnpm@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 with: version: 10.0.0 - name: Install NodeJS Deps run: pnpm install - name: Build Frontend run: pnpm run build-frontend - name: Upload frontend artifact uses: https://git.quad4.io/actions/upload-artifact@c24449f33cd45d4826c6702db7e49f7cdb9b551d # v3-node20 with: name: frontend-build path: meshchatx/public if-no-files-found: error build_desktop: name: Build Desktop (linux) needs: build_frontend runs-on: ubuntu-latest permissions: contents: write steps: - name: Clone Repo if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Install NodeJS if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version: 22 - name: Install Python if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: "3.13" - name: Install Poetry if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: python -m pip install --upgrade pip poetry>=2.0.0 - name: Sync versions if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: python scripts/sync_version.py - name: Install Python Deps if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: python -m poetry install - name: Install pnpm if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/setup-pnpm@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 with: version: 10.0.0 - name: Install NodeJS Deps if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: pnpm install - name: Prepare frontend directory if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: python scripts/prepare_frontend_dir.py - name: Download frontend artifact if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: frontend-build path: meshchatx/public - name: Install system dependencies if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: sudo apt-get update && sudo apt-get install -y patchelf libopusfile0 ffmpeg espeak-ng - name: Build Python wheel if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: | python -m poetry build -f wheel mkdir -p python-dist mv dist/*.whl python-dist/ rm -rf dist - name: Build Electron App (Universal) if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) run: pnpm run dist-prebuilt - name: Upload build artifacts if: | github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_linux == true) uses: https://git.quad4.io/actions/upload-artifact@c24449f33cd45d4826c6702db7e49f7cdb9b551d # v3-node20 with: name: build-linux path: | dist/*-linux*.AppImage dist/*-linux*.deb python-dist/*.whl if-no-files-found: ignore create_release: name: Create Release needs: build_desktop runs-on: ubuntu-latest if: github.event_name == 'push' permissions: contents: write steps: - name: Download all artifacts uses: https://git.quad4.io/actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: path: artifacts - name: Display structure of downloaded files run: ls -R artifacts - name: Prepare release assets run: | mkdir -p release-assets find artifacts -type f \( -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.whl" \) -exec cp {} release-assets/ \; ls -lh release-assets/ - name: Generate SHA256 checksums run: | cd release-assets echo "## SHA256 Checksums" > release-body.md echo "" >> release-body.md for file in *.exe *.dmg *.AppImage *.deb *.whl; do if [ -f "$file" ]; then sha256sum "$file" | tee "${file}.sha256" echo "\`$(cat "${file}.sha256")\`" >> release-body.md fi done echo "" >> release-body.md echo "Individual \`.sha256\` files are included for each artifact." >> release-body.md cat release-body.md echo "" echo "Generated .sha256 files:" ls -1 *.sha256 2>/dev/null || echo "No .sha256 files found" - name: Create Release uses: https://git.quad4.io/actions/gitea-release-action@fe8e0322804b48e34e3bddbbf6335bd2b1046eb7 # v1 with: draft: true artifacts: "release-assets/*" bodyFile: "release-assets/release-body.md" build_docker: runs-on: ubuntu-latest if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.build_docker == 'true') permissions: packages: write contents: read steps: - name: Clone Repo uses: https://git.quad4.io/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Set lowercase repository owner run: echo "REPO_OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV - name: Set up QEMU uses: https://git.quad4.io/actions/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 - name: Set up Docker Buildx uses: https://git.quad4.io/actions/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - name: Log in to the GitHub Container registry uses: https://git.quad4.io/actions/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker images uses: https://git.quad4.io/actions/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: >- ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchatx:latest, ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchatx:${{ github.ref_name }} labels: >- org.opencontainers.image.title=Reticulum MeshChatX, org.opencontainers.image.description=Docker image for Reticulum MeshChatX, org.opencontainers.image.url=https://github.com/${{ github.repository }}/pkgs/container/reticulum-meshchatx/