diff --git a/.forgejo/workflows/build-nix.yml b/.forgejo/workflows/build-nix.yml new file mode 100644 index 000000000..b569129e6 --- /dev/null +++ b/.forgejo/workflows/build-nix.yml @@ -0,0 +1,71 @@ +name: Build / Static via Nix + +concurrency: + group: "build-nix-${{ forge.ref }}" + cancel-in-progress: true + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + schedule: + - cron: '30 0 * * *' + +jobs: + build: + name: "Build Binaries" + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - package: default-static-x86_64 + filename: conduwuit-linux-static-amd64 + - package: default-static-aarch64 + filename: conduwuit-linux-static-arm64 + + - package: max-perf-static-aarch64 + filename: conduwuit-linux-static-arm64-maxperf + - package: max-perf-haswell-static-x86_64 + filename: conduwuit-haswell-linux-static-amd64-maxperf + + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 + + - name: Install Lix + uses: https://github.com/samueldr/lix-gha-installer-action@a0fee77b2a98bb7c5c0ed7ae6d6ad4903dbdad0d + with: + extra_nix_config: experimental-features = nix-command flakes flake-self-attrs + + - name: Build static binary + run: | + nix build .#${{ matrix.package }} + install -D result/bin/conduwuit /tmp/binaries/${{ matrix.filename }} + + - name: Upload binary artifact + uses: forgejo/upload-artifact@v4 + with: + name: ${{ matrix.filename }} + path: /tmp/binaries/${{ matrix.filename }} + + release-binaries: + name: "Release Binaries" + runs-on: ubuntu-latest + needs: + - build + permissions: + contents: write + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download binary artifacts + uses: forgejo/download-artifact@v4 + with: + pattern: conduwuit* + path: binaries + merge-multiple: true + - name: Create Release and Upload + uses: https://github.com/softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3 + with: + draft: true + files: binaries/*