mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
generate release matrix
This commit is contained in:
parent
ca1c99548b
commit
ed4cad0874
2 changed files with 28 additions and 20 deletions
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
|
|
@ -6,26 +6,21 @@ on:
|
|||
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v20
|
||||
- id: set-matrix
|
||||
run: echo "matrix=$(nix eval --json ".#releaseMatrix.x86_64-linux")" | tee $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: matrix
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-pc-windows-gnu
|
||||
artifact_name: palantir.exe
|
||||
asset_name: palantir-x86_64-windows.exe
|
||||
- target: x86_64-unknown-linux-musl
|
||||
artifact_name: palantir
|
||||
asset_name: palantir-x86_64-linux
|
||||
- target: i686-unknown-linux-musl
|
||||
artifact_name: palantir
|
||||
asset_name: palantir-i686-linux
|
||||
- target: armv7-unknown-linux-musleabihf
|
||||
artifact_name: palantir
|
||||
asset_name: palantir-armv7-linux
|
||||
- target: aarch64-unknown-linux-musl
|
||||
artifact_name: palantir
|
||||
asset_name: palantir-aarch64-linux
|
||||
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v20
|
||||
|
|
|
|||
19
flake.nix
19
flake.nix
|
|
@ -30,16 +30,22 @@
|
|||
inherit system overlays;
|
||||
};
|
||||
|
||||
hostTarget = pkgs.hostPlatform.config;
|
||||
targets = [
|
||||
"x86_64-unknown-linux-gnu"
|
||||
hostTarget
|
||||
"x86_64-pc-windows-gnu"
|
||||
"x86_64-unknown-linux-musl"
|
||||
"i686-unknown-linux-musl"
|
||||
"armv7-unknown-linux-musleabihf"
|
||||
"aarch64-unknown-linux-musl"
|
||||
];
|
||||
];
|
||||
|
||||
releaseTargets = lib.lists.remove hostTarget targets;
|
||||
|
||||
toolchain = (pkgs.rust-bin.stable.latest.default.override { inherit targets; });
|
||||
execSufficForTarget = target: if lib.strings.hasInfix "windows" target then ".exe" else "";
|
||||
artifactForTarget = target: "palantir${execSufficForTarget target}";
|
||||
assetNameForTarget = target: "palantir-${builtins.replaceStrings ["-unknown" "-gnu" "-musl" "abihf" "-pc"] ["" "" "" "" ""] target}${execSufficForTarget target}";
|
||||
|
||||
crossArgs = {
|
||||
"armv7-unknown-linux-musleabihf" = {
|
||||
|
|
@ -97,7 +103,7 @@
|
|||
postInstall = addUdev;
|
||||
|
||||
CARGO_BUILD_TARGET = target;
|
||||
} // (if (pkgs.hostPlatform.config != target) then (crossArgs.${target} or {}) else {}));
|
||||
} // (if (hostTarget != target) then (crossArgs.${target} or {}) else {}));
|
||||
buildAny = target: if (nixpkgs.lib.strings.hasInfix "windows" target) then (buildWindows target) else (buildLinux target);
|
||||
in rec {
|
||||
# `nix build`
|
||||
|
|
@ -120,6 +126,13 @@
|
|||
defaultApp = apps.palantir;
|
||||
|
||||
inherit targets;
|
||||
releaseMatrix = {
|
||||
include = builtins.map (target: {
|
||||
inherit target;
|
||||
artifact_name = artifactForTarget target;
|
||||
asset_name = assetNameForTarget target;
|
||||
}) releaseTargets;
|
||||
};
|
||||
|
||||
# `nix develop`
|
||||
devShells.default = pkgs.mkShell {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue