Change how release naming works, include build number

This commit is contained in:
Brian Picciano 2024-12-20 13:34:45 +01:00
parent aa593ceae3
commit 0a2bad11f6
6 changed files with 44 additions and 24 deletions

View File

@ -3,8 +3,13 @@
hostSystem ? buildSystem,
pkgsNix ? (import ./nix/pkgs.nix),
# We allow passing in the revision because nix flakes have their own mechanism
# for determining the git revision, and they don't have the git repo present
# to determine it off of the normal way.
revision ? null,
releaseName ? "dev",
buildNumber ? "1",
}: let
pkgs = pkgsNix.default {
@ -35,7 +40,7 @@ in rec {
version = pkgs.stdenv.mkDerivation {
name = "isle-version";
inherit buildSystem hostSystem revisionFile releaseName;
inherit buildSystem hostSystem revisionFile;
goVersion = pkgs.go.version;
garageVersion = garageNix.version;
@ -46,9 +51,8 @@ in rec {
versionFile=version
echo "Release: $releaseName" >> "$versionFile"
echo "Version: $(cat $revisionFile)" >> "$versionFile"
echo "Platform: $hostSystem" >> "$versionFile"
echo "Git Revision: $(cat $revisionFile)" >> "$versionFile"
echo "Go Version: $goVersion" >> "$versionFile"
echo "Garage Version: $garageVersion" >> "$versionFile"
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
@ -145,6 +149,7 @@ in rec {
};
build = rec {
appImage = pkgs.stdenv.mkDerivation {
name = "isle-AppImage";
src = appDir {};
@ -164,13 +169,13 @@ in rec {
};
archPkg = ((import ./dist/linux/arch) {
inherit hostSystem releaseName;
inherit hostSystem releaseName buildNumber;
pkgs = pkgsNative;
appDir = appDir { systemRoot = "/"; };
});
debPkg = ((import ./dist/linux/deb) {
inherit hostSystem releaseName;
inherit hostSystem releaseName buildNumber;
pkgs = pkgsNative;
appDir = appDir { systemRoot = "/"; };
});

View File

@ -2,6 +2,7 @@
pkgs,
hostSystem,
releaseName,
buildNumber ? "1",
appDir,
}: let
@ -10,7 +11,7 @@
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
pkgname=isle
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
pkgrel=0
pkgrel=${buildNumber}
pkgdesc="The foundation for an autonomous community cloud infrastructure"
arch=('${cpuArch}')
url="https://code.betamike.com/micropelago/isle"

View File

@ -2,6 +2,7 @@
pkgs,
hostSystem,
releaseName,
buildNumber ? "1",
appDir,
}: let
@ -14,7 +15,7 @@
control = pkgs.writeTextDir "DEBIAN/control" ''
Package: isle
Version: ${releaseName}
Version: ${releaseName}-${buildNumber}
Section: net
Priority: optional
Architecture: ${debArch}
@ -49,7 +50,7 @@
};
in pkgs.stdenv.mkDerivation {
name = "isle-deb-pkg-${releaseName}-${debArch}";
name = "isle-deb-pkg";
nativeBuildInputs = [
pkgs.zstd
pkgs.dpkg
@ -63,7 +64,7 @@ in pkgs.stdenv.mkDerivation {
dpkg-deb \
--root-owner-group \
-Z zstd \
-b root isle_${releaseName}_${debArch}.deb
-b root isle_${releaseName}-${buildNumber}_${debArch}.deb
'';
installPhase = ''
mkdir -p "$out"

View File

@ -8,12 +8,21 @@ A release consists of:
- A file containing a signature of the hash file, created by whoever is building
the release.
Releases are named using semantic versioning: <major>.<minor>.<patch>. A
preceding "v" is NOT a part of the canonical release name, though it use used in
specific contexts.
Release artifacts are also be labeled with a suffix indicating build number, eg
"0.1.3-2" which indicates that this is of release "0.1.3". The first build of a
release is always "1". Different build numbers of the same release indicate that
no code is different, only the packaging.
## 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.
the `./release.sh` script, providing the release name and build number.
From here an `isle` binary will be cross-compiled for all supported
platforms. This will take a long time the first time you perform it on your
@ -25,12 +34,13 @@ create the signature.
## Releasing
Release artifactes are hosted at `micropelago.net` under
`/isle/releases/<release name>`. An `index.gmi` page should be created in that
Release artifacts are hosted at `micropelago.net` under
`/isle/releases/v<release name>`. An `index.gmi` page should be created in that
directory which includes links to each artifact, as well as a changelog
detailing all new features and fixes included since the previous release.
A link to the new release should be included at `/isle/releases/index.gmi`.
The release shoulld be tagged in the git repo using its release name as well,
with the tag notes linking to the `micropelago.net` page.
Each release should be tagged in the git repo using the release name and build
number prefixed with a "v". If the build number of the release is "1" then the
tag notes should link to the `micropelago.net` release page for the release.

View File

@ -1,11 +1,10 @@
{
revision ? "dev",
releaseName ? "dev",
buildNumber ? "1",
buildSystem ? builtins.currentSystem,
pkgsNix ? (import ./nix/pkgs.nix),
supportedSystems ? pkgsNix.supportedSystems,
}: let
pkgs = pkgsNix.default { inherit buildSystem; };
@ -13,12 +12,12 @@
mkRelease = hostSystem: let
build = ((import ./default.nix) {
inherit buildSystem hostSystem releaseName revision;
inherit buildSystem hostSystem releaseName buildNumber;
}).build;
in pkgs.stdenv.mkDerivation {
name = "isle-release-${hostSystem}";
inherit releaseName hostSystem;
inherit releaseName buildNumber hostSystem;
appImage = build.appImage;
archPkg = build.archPkg;
@ -28,7 +27,7 @@
source $stdenv/setup
mkdir -p "$out"/
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$hostSystem.AppImage
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$buildNumber-$hostSystem.AppImage
cp "$archPkg"/* "$out"/
cp "$debPkg"/* "$out"/
'';

View File

@ -7,21 +7,25 @@ cd "$scriptDir"
releaseName="$1"
if [ -z "$releaseName" ]; then
echo "USAGE: $0 \"v0.1.2\""
echo "USAGE: $0 \"0.1.2\" [build number]"
exit 1
fi
buildNumber="$2"
if [ -z "$buildNumber" ]; then
buildNumber="0"
fi
releasesDir="$(pwd)/releases"
mkdir -p "$releasesDir"
echo '*' > "$releasesDir"/.gitignore
out="$releasesDir/$releaseName"
revision=$(git rev-parse HEAD)
out="$releasesDir/$releaseName-$buildNumber"
rm -rf "$out"
result=$(nix-build -v \
--argstr revision "$revision" \
--argstr releaseName "$releaseName" \
--argstr buildNumber "$buildNumber" \
--no-out-link \
release.nix \
)