Implement release script
This commit is contained in:
parent
e9190e4dbb
commit
3a3bd56295
@ -100,6 +100,7 @@ Documentation for devs:
|
|||||||
describing the [pmux](https://code.betamike.com/cryptic-io/pmux) process tree
|
describing the [pmux](https://code.betamike.com/cryptic-io/pmux) process tree
|
||||||
created by `cryptic-net daemon` at runtime.
|
created by `cryptic-net daemon` at runtime.
|
||||||
* [Rebuilding Documentation](docs/dev/rebuilding-documentation.md)
|
* [Rebuilding Documentation](docs/dev/rebuilding-documentation.md)
|
||||||
|
* [Releases](docs/dev/releases.md)
|
||||||
|
|
||||||
## Misc
|
## Misc
|
||||||
|
|
||||||
|
36
default.nix
36
default.nix
@ -1,21 +1,25 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
buildSystem ? builtins.currentSystem,
|
buildSystem ? builtins.currentSystem,
|
||||||
hostSystem ? builtins.currentSystem,
|
hostSystem ? buildSystem,
|
||||||
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
|
|
||||||
revision ? "",
|
revision ? "",
|
||||||
releaseName ? "debug",
|
releaseName ? "dev",
|
||||||
|
|
||||||
bootstrap ? null,
|
bootstrap ? null,
|
||||||
|
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
pkgsNix = (import ./nix/pkgs.nix);
|
|
||||||
|
|
||||||
pkgs = pkgsNix.default {
|
pkgs = pkgsNix.default {
|
||||||
inherit buildSystem hostSystem;
|
inherit buildSystem hostSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pkgsNative = pkgsNix.default {
|
||||||
|
inherit buildSystem;
|
||||||
|
hostSystem = buildSystem;
|
||||||
|
};
|
||||||
|
|
||||||
garageNix = (import ./nix/garage.nix);
|
garageNix = (import ./nix/garage.nix);
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
@ -23,17 +27,15 @@ in rec {
|
|||||||
version = pkgs.stdenv.mkDerivation {
|
version = pkgs.stdenv.mkDerivation {
|
||||||
name = "cryptic-net-version";
|
name = "cryptic-net-version";
|
||||||
|
|
||||||
inherit buildSystem revision releaseName;
|
inherit buildSystem hostSystem revision releaseName;
|
||||||
repoSrc = ./.;
|
repoSrc = ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.git ];
|
nativeBuildInputs = [ pkgsNative.git ];
|
||||||
|
|
||||||
goVersion = pkgs.go.version;
|
goVersion = pkgs.go.version;
|
||||||
garageVersion = garageNix.version;
|
garageVersion = garageNix.version;
|
||||||
nixpkgsVersion = pkgsNix.version;
|
nixpkgsVersion = pkgsNix.version;
|
||||||
|
|
||||||
release = "${releaseName}-${hostSystem}";
|
|
||||||
|
|
||||||
builder = builtins.toFile "builder.sh" ''
|
builder = builtins.toFile "builder.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
@ -44,7 +46,8 @@ in rec {
|
|||||||
revision="$(cd repoSrcCp && git rev-parse HEAD)"
|
revision="$(cd repoSrcCp && git rev-parse HEAD)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Release $release" >> "$versionFile"
|
echo "Release: $releaseName" >> "$versionFile"
|
||||||
|
echo "Platform: $hostSystem" >> "$versionFile"
|
||||||
echo "Git Revision: $revision" >> "$versionFile"
|
echo "Git Revision: $revision" >> "$versionFile"
|
||||||
echo "Go Version: $goVersion" >> "$versionFile"
|
echo "Go Version: $goVersion" >> "$versionFile"
|
||||||
echo "Garage Version: $garageVersion" >> "$versionFile"
|
echo "Garage Version: $garageVersion" >> "$versionFile"
|
||||||
@ -132,19 +135,4 @@ in rec {
|
|||||||
mv Cryptic_Net-* "$out"/bin/cryptic-net
|
mv Cryptic_Net-* "$out"/bin/cryptic-net
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
release = pkgs.stdenv.mkDerivation {
|
|
||||||
name = "cryptic-net-release";
|
|
||||||
inherit appImage;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.coreutils ];
|
|
||||||
|
|
||||||
builder = builtins.toFile "build.sh" ''
|
|
||||||
source $stdenv/setup
|
|
||||||
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp "$appImage" "$out"/cryptic-net
|
|
||||||
(cd "$out" && sha256sum * > sha256.txt)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
32
docs/dev/releases.md
Normal file
32
docs/dev/releases.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Releases
|
||||||
|
|
||||||
|
A release consists of:
|
||||||
|
|
||||||
|
- A full set of binaries for all supported platforms, compiled from the same
|
||||||
|
source.
|
||||||
|
- A text file containing hashes of each binary.
|
||||||
|
- A file containing a signature of the hash file, created by whoever is building
|
||||||
|
the release.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
*NOTE: This has only been tested from an x86_64 linux machine*
|
||||||
|
|
||||||
|
To create a release only a functional nix installation is required. Simply run
|
||||||
|
the `./release.sh` script, and input a release name when prompted.
|
||||||
|
|
||||||
|
From here a cryptic-net binary will be cross-compiled for all supported
|
||||||
|
platforms. This will take a long time the first time you perform it on your
|
||||||
|
machine.
|
||||||
|
|
||||||
|
Once compilation is completely, the release will be signed using the default GPG
|
||||||
|
key on your machine, and you will be prompted for its password in order to
|
||||||
|
create the signature.
|
||||||
|
|
||||||
|
## Releasing
|
||||||
|
|
||||||
|
Releases are uploaded to the repository's Releases page, and release naming
|
||||||
|
follows the conventional semantic versioning system. Each release should be
|
||||||
|
accompanied by a set of changes which have occurred since the last release,
|
||||||
|
described both in the `CHANGELOG.md` file and in the description on the Release
|
||||||
|
itself.
|
19
flake.nix
19
flake.nix
@ -7,12 +7,7 @@
|
|||||||
self, utils,
|
self, utils,
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
supportedSystems = [
|
supportedSystems = (import ./nix/pkgs.nix).supportedSystems;
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
"armv7l-linux" # rpi, I think?
|
|
||||||
"i686-linux"
|
|
||||||
];
|
|
||||||
|
|
||||||
mkPkg = (buildSystem: hostSystem: let
|
mkPkg = (buildSystem: hostSystem: let
|
||||||
|
|
||||||
@ -26,15 +21,9 @@
|
|||||||
defaultAttrs.appImage
|
defaultAttrs.appImage
|
||||||
);
|
);
|
||||||
|
|
||||||
#pkgsForBuildSystem = (buildSystem: builtins.foldl'
|
pkgsForBuildSystem = (buildSystem: {
|
||||||
# (sysPkgs: hostSystem:
|
default = mkPkg buildSystem buildSystem;
|
||||||
# sysPkgs // { "compiled-for-${hostSystem}" = mkPkg buildSystem hostSystem; })
|
});
|
||||||
# { default = mkPkg buildSystem buildSystem; }
|
|
||||||
# supportedSystems
|
|
||||||
#);
|
|
||||||
|
|
||||||
pkgsForBuildSystem = (buildSystem:
|
|
||||||
{ default = mkPkg buildSystem buildSystem; });
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
@ -35,9 +35,16 @@ rec {
|
|||||||
sha256 = "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=";
|
sha256 = "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
#"armv7l-linux-musl" # rpi, I think?
|
||||||
|
"i686-linux"
|
||||||
|
];
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
buildSystem,
|
buildSystem,
|
||||||
hostSystem,
|
hostSystem ? buildSystem,
|
||||||
}: import src {
|
}: import src {
|
||||||
system = buildSystem;
|
system = buildSystem;
|
||||||
crossSystem.config = hostSystem;
|
crossSystem.config = hostSystem;
|
||||||
|
50
release.nix
Normal file
50
release.nix
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
releaseName,
|
||||||
|
|
||||||
|
buildSystem ? builtins.currentSystem,
|
||||||
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
|
supportedSystems ? pkgsNix.supportedSystems,
|
||||||
|
|
||||||
|
}: let
|
||||||
|
|
||||||
|
pkgs = pkgsNix.default { inherit buildSystem; };
|
||||||
|
|
||||||
|
mkRelease = hostSystem: let
|
||||||
|
|
||||||
|
appImage = ((import ./default.nix) {
|
||||||
|
inherit buildSystem hostSystem releaseName;
|
||||||
|
}).appImage;
|
||||||
|
|
||||||
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
name = "cryptic-net-release-${hostSystem}";
|
||||||
|
inherit releaseName appImage hostSystem;
|
||||||
|
|
||||||
|
builder = builtins.toFile "build.sh" ''
|
||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
mkdir -p "$out"/
|
||||||
|
cp "$appImage"/bin/cryptic-net "$out"/cryptic-net-$releaseName-$hostSystem
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
releases = builtins.map mkRelease supportedSystems;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
name = "cryptic-net-release-${releaseName}";
|
||||||
|
inherit releases;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgs.coreutils ];
|
||||||
|
|
||||||
|
builder = builtins.toFile "build.sh" ''
|
||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
for p in $releases; do
|
||||||
|
cp "$p"/cryptic-net-* "$out"/
|
||||||
|
done
|
||||||
|
|
||||||
|
(cd "$out" && sha256sum * > sha256.txt)
|
||||||
|
'';
|
||||||
|
}
|
34
release.sh
Executable file
34
release.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
scriptDir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
|
||||||
|
cd "$scriptDir"
|
||||||
|
|
||||||
|
printf "Release name (e.g. \"v0.1.2\"): "
|
||||||
|
read -r releaseName
|
||||||
|
|
||||||
|
releasesDir="$(pwd)/releases"
|
||||||
|
mkdir -p "$releasesDir"
|
||||||
|
echo '*' > "$releasesDir"/.gitignore
|
||||||
|
|
||||||
|
out="$releasesDir/$releaseName"
|
||||||
|
|
||||||
|
if [ -e "$out" ]; then
|
||||||
|
echo "$out already exists, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
result=$(nix-build \
|
||||||
|
--argstr releaseName "$releaseName" \
|
||||||
|
--no-out-link \
|
||||||
|
release.nix \
|
||||||
|
)
|
||||||
|
|
||||||
|
cp -rL "$result" "$out"
|
||||||
|
chmod u+w -R "$out"
|
||||||
|
|
||||||
|
cd "$out"
|
||||||
|
gpg -a --detach-sign -o sha256.txt.gpg ./sha256.txt
|
||||||
|
|
||||||
|
echo "Release successfully created: $out"
|
Loading…
Reference in New Issue
Block a user