# GitHub Actions workflow # to build `deltachat-rpc-server` binaries # and upload them to the release. # # The workflow is automatically triggered on releases. # It can also be triggered manually # to produce binary artifacts for testing. name: Build deltachat-rpc-server binaries concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: workflow_dispatch: release: types: [published] permissions: {} jobs: # Build a version statically linked against musl libc # to avoid problems with glibc version incompatibility. build_linux: name: Linux strategy: fail-fast: false matrix: arch: [aarch64, armv7l, armv6l, i686, x86_64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server binaries run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-linux - name: Upload binary uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-linux path: result/bin/deltachat-rpc-server if-no-files-found: error build_linux_wheel: name: Linux wheel strategy: fail-fast: false matrix: arch: [aarch64, armv7l, armv6l, i686, x86_64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server wheels run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-linux-wheel - name: Upload wheel uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-linux-wheel path: result/*.whl if-no-files-found: error build_windows: name: Windows strategy: fail-fast: false matrix: arch: [win32, win64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server binaries run: nix build .#deltachat-rpc-server-${{ matrix.arch }} - name: Upload binary uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }} path: result/bin/deltachat-rpc-server.exe if-no-files-found: error build_windows_wheel: name: Windows wheel strategy: fail-fast: false matrix: arch: [win32, win64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server wheels run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-wheel - name: Upload wheel uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-wheel path: result/*.whl if-no-files-found: error build_macos: name: macOS strategy: fail-fast: false matrix: arch: [x86_64, aarch64] runs-on: macos-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - name: Setup rust target run: rustup target add ${{ matrix.arch }}-apple-darwin - name: Build run: cargo build --release --package deltachat-rpc-server --target ${{ matrix.arch }}-apple-darwin --features vendored - name: Upload binary uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-macos path: target/${{ matrix.arch }}-apple-darwin/release/deltachat-rpc-server if-no-files-found: error build_android: name: Android strategy: fail-fast: false matrix: arch: [arm64-v8a, armeabi-v7a] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server binaries run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-android - name: Upload binary uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-android path: result/bin/deltachat-rpc-server if-no-files-found: error build_android_wheel: name: Android wheel strategy: fail-fast: false matrix: arch: [arm64-v8a, armeabi-v7a] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Build deltachat-rpc-server wheels run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-android-wheel - name: Upload wheel uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-${{ matrix.arch }}-android-wheel path: result/*.whl if-no-files-found: error publish: name: Build wheels and upload binaries to the release needs: ["build_linux", "build_linux_wheel", "build_windows", "build_windows_wheel", "build_macos", "build_android", "build_android_wheel"] environment: name: pypi url: https://pypi.org/p/deltachat-rpc-server permissions: id-token: write contents: write runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - name: Download Linux aarch64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-aarch64-linux path: deltachat-rpc-server-aarch64-linux.d - name: Download Linux aarch64 wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-aarch64-linux-wheel path: deltachat-rpc-server-aarch64-linux-wheel.d - name: Download Linux armv7l binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv7l-linux path: deltachat-rpc-server-armv7l-linux.d - name: Download Linux armv7l wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv7l-linux-wheel path: deltachat-rpc-server-armv7l-linux-wheel.d - name: Download Linux armv6l binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv6l-linux path: deltachat-rpc-server-armv6l-linux.d - name: Download Linux armv6l wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv6l-linux-wheel path: deltachat-rpc-server-armv6l-linux-wheel.d - name: Download Linux i686 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-i686-linux path: deltachat-rpc-server-i686-linux.d - name: Download Linux i686 wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-i686-linux-wheel path: deltachat-rpc-server-i686-linux-wheel.d - name: Download Linux x86_64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-x86_64-linux path: deltachat-rpc-server-x86_64-linux.d - name: Download Linux x86_64 wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-x86_64-linux-wheel path: deltachat-rpc-server-x86_64-linux-wheel.d - name: Download Win32 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win32 path: deltachat-rpc-server-win32.d - name: Download Win32 wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win32-wheel path: deltachat-rpc-server-win32-wheel.d - name: Download Win64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win64 path: deltachat-rpc-server-win64.d - name: Download Win64 wheel uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win64-wheel path: deltachat-rpc-server-win64-wheel.d - name: Download macOS binary for x86_64 uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-x86_64-macos path: deltachat-rpc-server-x86_64-macos.d - name: Download macOS binary for aarch64 uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-aarch64-macos path: deltachat-rpc-server-aarch64-macos.d - name: Download Android binary for arm64-v8a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-arm64-v8a-android path: deltachat-rpc-server-arm64-v8a-android.d - name: Download Android wheel for arm64-v8a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-arm64-v8a-android-wheel path: deltachat-rpc-server-arm64-v8a-android-wheel.d - name: Download Android binary for armeabi-v7a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armeabi-v7a-android path: deltachat-rpc-server-armeabi-v7a-android.d - name: Download Android wheel for armeabi-v7a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armeabi-v7a-android-wheel path: deltachat-rpc-server-armeabi-v7a-android-wheel.d - name: Create bin/ directory run: | mkdir -p bin mv deltachat-rpc-server-aarch64-linux.d/deltachat-rpc-server bin/deltachat-rpc-server-aarch64-linux mv deltachat-rpc-server-armv7l-linux.d/deltachat-rpc-server bin/deltachat-rpc-server-armv7l-linux mv deltachat-rpc-server-armv6l-linux.d/deltachat-rpc-server bin/deltachat-rpc-server-armv6l-linux mv deltachat-rpc-server-i686-linux.d/deltachat-rpc-server bin/deltachat-rpc-server-i686-linux mv deltachat-rpc-server-x86_64-linux.d/deltachat-rpc-server bin/deltachat-rpc-server-x86_64-linux mv deltachat-rpc-server-win32.d/deltachat-rpc-server.exe bin/deltachat-rpc-server-win32.exe mv deltachat-rpc-server-win64.d/deltachat-rpc-server.exe bin/deltachat-rpc-server-win64.exe mv deltachat-rpc-server-x86_64-macos.d/deltachat-rpc-server bin/deltachat-rpc-server-x86_64-macos mv deltachat-rpc-server-aarch64-macos.d/deltachat-rpc-server bin/deltachat-rpc-server-aarch64-macos mv deltachat-rpc-server-arm64-v8a-android.d/deltachat-rpc-server bin/deltachat-rpc-server-arm64-v8a-android mv deltachat-rpc-server-armeabi-v7a-android.d/deltachat-rpc-server bin/deltachat-rpc-server-armeabi-v7a-android - name: List binaries run: ls -l bin/ - name: Install wheel run: pip install wheel - name: Build deltachat-rpc-server Python wheels run: | mkdir -p dist mv deltachat-rpc-server-aarch64-linux-wheel.d/*.whl dist/ mv deltachat-rpc-server-armv7l-linux-wheel.d/*.whl dist/ mv deltachat-rpc-server-armv6l-linux-wheel.d/*.whl dist/ mv deltachat-rpc-server-i686-linux-wheel.d/*.whl dist/ mv deltachat-rpc-server-x86_64-linux-wheel.d/*.whl dist/ mv deltachat-rpc-server-win64-wheel.d/*.whl dist/ mv deltachat-rpc-server-win32-wheel.d/*.whl dist/ mv deltachat-rpc-server-arm64-v8a-android-wheel.d/*.whl dist/ mv deltachat-rpc-server-armeabi-v7a-android-wheel.d/*.whl dist/ python3 scripts/wheel-rpc-server.py x86_64-darwin bin/deltachat-rpc-server-x86_64-macos python3 scripts/wheel-rpc-server.py aarch64-darwin bin/deltachat-rpc-server-aarch64-macos mv *.whl dist/ - name: List artifacts run: ls -l dist/ - name: Upload binaries to the GitHub release if: github.event_name == 'release' env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" REF_NAME: ${{ github.ref_name }} run: | gh release upload "$REF_NAME" \ --repo ${{ github.repository }} \ bin/* dist/* - name: Publish deltachat-rpc-server to PyPI if: github.event_name == 'release' uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e publish_npm_package: name: Build & Publish npm prebuilds and deltachat-rpc-server needs: ["build_linux", "build_windows", "build_macos"] runs-on: "ubuntu-latest" environment: name: npm-stdio-rpc-server url: https://www.npmjs.com/package/@deltachat/stdio-rpc-server permissions: id-token: write # Needed to publish the binaries to the release. contents: write steps: - uses: actions/checkout@v6 with: show-progress: false persist-credentials: false - uses: actions/setup-python@v6 with: python-version: "3.11" - name: Download Linux aarch64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-aarch64-linux path: deltachat-rpc-server-aarch64-linux.d - name: Download Linux armv7l binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv7l-linux path: deltachat-rpc-server-armv7l-linux.d - name: Download Linux armv6l binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armv6l-linux path: deltachat-rpc-server-armv6l-linux.d - name: Download Linux i686 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-i686-linux path: deltachat-rpc-server-i686-linux.d - name: Download Linux x86_64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-x86_64-linux path: deltachat-rpc-server-x86_64-linux.d - name: Download Win32 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win32 path: deltachat-rpc-server-win32.d - name: Download Win64 binary uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-win64 path: deltachat-rpc-server-win64.d - name: Download macOS binary for x86_64 uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-x86_64-macos path: deltachat-rpc-server-x86_64-macos.d - name: Download macOS binary for aarch64 uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-aarch64-macos path: deltachat-rpc-server-aarch64-macos.d - name: Download Android binary for arm64-v8a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-arm64-v8a-android path: deltachat-rpc-server-arm64-v8a-android.d - name: Download Android binary for armeabi-v7a uses: actions/download-artifact@v7 with: name: deltachat-rpc-server-armeabi-v7a-android path: deltachat-rpc-server-armeabi-v7a-android.d - name: make npm packets for prebuilds and `@deltachat/stdio-rpc-server` run: | cd deltachat-rpc-server/npm-package python --version python scripts/pack_binary_for_platform.py aarch64-unknown-linux-musl ../../deltachat-rpc-server-aarch64-linux.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py armv7-unknown-linux-musleabihf ../../deltachat-rpc-server-armv7l-linux.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py arm-unknown-linux-musleabihf ../../deltachat-rpc-server-armv6l-linux.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py i686-unknown-linux-musl ../../deltachat-rpc-server-i686-linux.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py x86_64-unknown-linux-musl ../../deltachat-rpc-server-x86_64-linux.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py i686-pc-windows-gnu ../../deltachat-rpc-server-win32.d/deltachat-rpc-server.exe python scripts/pack_binary_for_platform.py x86_64-pc-windows-gnu ../../deltachat-rpc-server-win64.d/deltachat-rpc-server.exe python scripts/pack_binary_for_platform.py x86_64-apple-darwin ../../deltachat-rpc-server-x86_64-macos.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py aarch64-apple-darwin ../../deltachat-rpc-server-aarch64-macos.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py aarch64-linux-android ../../deltachat-rpc-server-arm64-v8a-android.d/deltachat-rpc-server python scripts/pack_binary_for_platform.py armv7-linux-androideabi ../../deltachat-rpc-server-armeabi-v7a-android.d/deltachat-rpc-server ls -lah platform_package for platform in ./platform_package/*; do npm pack "$platform"; done npm pack ls -lah - name: Upload to artifacts uses: actions/upload-artifact@v7 with: name: deltachat-rpc-server-npm-package path: deltachat-rpc-server/npm-package/*.tgz if-no-files-found: error - name: Upload npm packets to the GitHub release if: github.event_name == 'release' env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" REF_NAME: ${{ github.ref_name }} run: | gh release upload "$REF_NAME" \ --repo ${{ github.repository }} \ deltachat-rpc-server/npm-package/*.tgz # Configure Node.js for publishing. - uses: actions/setup-node@v6 with: node-version: 20 registry-url: "https://registry.npmjs.org" # Ensure npm 11.5.1 or later is installed. # It is needed for - name: Update npm run: npm install -g npm@latest - name: Publish npm packets for prebuilds and `@deltachat/stdio-rpc-server` if: github.event_name == 'release' working-directory: deltachat-rpc-server/npm-package run: | ls -lah platform_package for platform in *.tgz; do npm publish --provenance "$platform" --access public; done