Change how release naming works, include build number
This commit is contained in:
parent
aa593ceae3
commit
0a2bad11f6
15
default.nix
15
default.nix
@ -3,8 +3,13 @@
|
|||||||
hostSystem ? buildSystem,
|
hostSystem ? buildSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
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,
|
revision ? null,
|
||||||
|
|
||||||
releaseName ? "dev",
|
releaseName ? "dev",
|
||||||
|
buildNumber ? "1",
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
pkgs = pkgsNix.default {
|
pkgs = pkgsNix.default {
|
||||||
@ -35,7 +40,7 @@ in rec {
|
|||||||
version = pkgs.stdenv.mkDerivation {
|
version = pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-version";
|
name = "isle-version";
|
||||||
|
|
||||||
inherit buildSystem hostSystem revisionFile releaseName;
|
inherit buildSystem hostSystem revisionFile;
|
||||||
|
|
||||||
goVersion = pkgs.go.version;
|
goVersion = pkgs.go.version;
|
||||||
garageVersion = garageNix.version;
|
garageVersion = garageNix.version;
|
||||||
@ -46,9 +51,8 @@ in rec {
|
|||||||
|
|
||||||
versionFile=version
|
versionFile=version
|
||||||
|
|
||||||
echo "Release: $releaseName" >> "$versionFile"
|
echo "Version: $(cat $revisionFile)" >> "$versionFile"
|
||||||
echo "Platform: $hostSystem" >> "$versionFile"
|
echo "Platform: $hostSystem" >> "$versionFile"
|
||||||
echo "Git Revision: $(cat $revisionFile)" >> "$versionFile"
|
|
||||||
echo "Go Version: $goVersion" >> "$versionFile"
|
echo "Go Version: $goVersion" >> "$versionFile"
|
||||||
echo "Garage Version: $garageVersion" >> "$versionFile"
|
echo "Garage Version: $garageVersion" >> "$versionFile"
|
||||||
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
||||||
@ -145,6 +149,7 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
build = rec {
|
build = rec {
|
||||||
|
|
||||||
appImage = pkgs.stdenv.mkDerivation {
|
appImage = pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-AppImage";
|
name = "isle-AppImage";
|
||||||
src = appDir {};
|
src = appDir {};
|
||||||
@ -164,13 +169,13 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
archPkg = ((import ./dist/linux/arch) {
|
archPkg = ((import ./dist/linux/arch) {
|
||||||
inherit hostSystem releaseName;
|
inherit hostSystem releaseName buildNumber;
|
||||||
pkgs = pkgsNative;
|
pkgs = pkgsNative;
|
||||||
appDir = appDir { systemRoot = "/"; };
|
appDir = appDir { systemRoot = "/"; };
|
||||||
});
|
});
|
||||||
|
|
||||||
debPkg = ((import ./dist/linux/deb) {
|
debPkg = ((import ./dist/linux/deb) {
|
||||||
inherit hostSystem releaseName;
|
inherit hostSystem releaseName buildNumber;
|
||||||
pkgs = pkgsNative;
|
pkgs = pkgsNative;
|
||||||
appDir = appDir { systemRoot = "/"; };
|
appDir = appDir { systemRoot = "/"; };
|
||||||
});
|
});
|
||||||
|
3
dist/linux/arch/default.nix
vendored
3
dist/linux/arch/default.nix
vendored
@ -2,6 +2,7 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
hostSystem,
|
hostSystem,
|
||||||
releaseName,
|
releaseName,
|
||||||
|
buildNumber ? "1",
|
||||||
appDir,
|
appDir,
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
@ -10,7 +11,7 @@
|
|||||||
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
|
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
|
||||||
pkgname=isle
|
pkgname=isle
|
||||||
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
|
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
|
||||||
pkgrel=0
|
pkgrel=${buildNumber}
|
||||||
pkgdesc="The foundation for an autonomous community cloud infrastructure"
|
pkgdesc="The foundation for an autonomous community cloud infrastructure"
|
||||||
arch=('${cpuArch}')
|
arch=('${cpuArch}')
|
||||||
url="https://code.betamike.com/micropelago/isle"
|
url="https://code.betamike.com/micropelago/isle"
|
||||||
|
7
dist/linux/deb/default.nix
vendored
7
dist/linux/deb/default.nix
vendored
@ -2,6 +2,7 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
hostSystem,
|
hostSystem,
|
||||||
releaseName,
|
releaseName,
|
||||||
|
buildNumber ? "1",
|
||||||
appDir,
|
appDir,
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
@ -14,7 +15,7 @@
|
|||||||
|
|
||||||
control = pkgs.writeTextDir "DEBIAN/control" ''
|
control = pkgs.writeTextDir "DEBIAN/control" ''
|
||||||
Package: isle
|
Package: isle
|
||||||
Version: ${releaseName}
|
Version: ${releaseName}-${buildNumber}
|
||||||
Section: net
|
Section: net
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: ${debArch}
|
Architecture: ${debArch}
|
||||||
@ -49,7 +50,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-deb-pkg-${releaseName}-${debArch}";
|
name = "isle-deb-pkg";
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkgs.zstd
|
pkgs.zstd
|
||||||
pkgs.dpkg
|
pkgs.dpkg
|
||||||
@ -63,7 +64,7 @@ in pkgs.stdenv.mkDerivation {
|
|||||||
dpkg-deb \
|
dpkg-deb \
|
||||||
--root-owner-group \
|
--root-owner-group \
|
||||||
-Z zstd \
|
-Z zstd \
|
||||||
-b root isle_${releaseName}_${debArch}.deb
|
-b root isle_${releaseName}-${buildNumber}_${debArch}.deb
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
|
@ -8,12 +8,21 @@ A release consists of:
|
|||||||
- A file containing a signature of the hash file, created by whoever is building
|
- A file containing a signature of the hash file, created by whoever is building
|
||||||
the release.
|
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
|
## Building
|
||||||
|
|
||||||
*NOTE: This has only been tested from an x86_64 linux machine*
|
*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
|
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
|
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
|
platforms. This will take a long time the first time you perform it on your
|
||||||
@ -25,12 +34,13 @@ create the signature.
|
|||||||
|
|
||||||
## Releasing
|
## Releasing
|
||||||
|
|
||||||
Release artifactes are hosted at `micropelago.net` under
|
Release artifacts are hosted at `micropelago.net` under
|
||||||
`/isle/releases/<release name>`. An `index.gmi` page should be created in that
|
`/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
|
directory which includes links to each artifact, as well as a changelog
|
||||||
detailing all new features and fixes included since the previous release.
|
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`.
|
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,
|
Each release should be tagged in the git repo using the release name and build
|
||||||
with the tag notes linking to the `micropelago.net` page.
|
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.
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
{
|
{
|
||||||
revision ? "dev",
|
|
||||||
releaseName ? "dev",
|
releaseName ? "dev",
|
||||||
|
buildNumber ? "1",
|
||||||
|
|
||||||
buildSystem ? builtins.currentSystem,
|
buildSystem ? builtins.currentSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
supportedSystems ? pkgsNix.supportedSystems,
|
supportedSystems ? pkgsNix.supportedSystems,
|
||||||
|
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
pkgs = pkgsNix.default { inherit buildSystem; };
|
pkgs = pkgsNix.default { inherit buildSystem; };
|
||||||
@ -13,12 +12,12 @@
|
|||||||
mkRelease = hostSystem: let
|
mkRelease = hostSystem: let
|
||||||
|
|
||||||
build = ((import ./default.nix) {
|
build = ((import ./default.nix) {
|
||||||
inherit buildSystem hostSystem releaseName revision;
|
inherit buildSystem hostSystem releaseName buildNumber;
|
||||||
}).build;
|
}).build;
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-release-${hostSystem}";
|
name = "isle-release-${hostSystem}";
|
||||||
inherit releaseName hostSystem;
|
inherit releaseName buildNumber hostSystem;
|
||||||
|
|
||||||
appImage = build.appImage;
|
appImage = build.appImage;
|
||||||
archPkg = build.archPkg;
|
archPkg = build.archPkg;
|
||||||
@ -28,7 +27,7 @@
|
|||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
mkdir -p "$out"/
|
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 "$archPkg"/* "$out"/
|
||||||
cp "$debPkg"/* "$out"/
|
cp "$debPkg"/* "$out"/
|
||||||
'';
|
'';
|
||||||
|
14
release.sh
14
release.sh
@ -7,21 +7,25 @@ cd "$scriptDir"
|
|||||||
|
|
||||||
releaseName="$1"
|
releaseName="$1"
|
||||||
if [ -z "$releaseName" ]; then
|
if [ -z "$releaseName" ]; then
|
||||||
echo "USAGE: $0 \"v0.1.2\""
|
echo "USAGE: $0 \"0.1.2\" [build number]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
buildNumber="$2"
|
||||||
|
if [ -z "$buildNumber" ]; then
|
||||||
|
buildNumber="0"
|
||||||
|
fi
|
||||||
|
|
||||||
releasesDir="$(pwd)/releases"
|
releasesDir="$(pwd)/releases"
|
||||||
mkdir -p "$releasesDir"
|
mkdir -p "$releasesDir"
|
||||||
echo '*' > "$releasesDir"/.gitignore
|
echo '*' > "$releasesDir"/.gitignore
|
||||||
|
|
||||||
out="$releasesDir/$releaseName"
|
out="$releasesDir/$releaseName-$buildNumber"
|
||||||
|
rm -rf "$out"
|
||||||
revision=$(git rev-parse HEAD)
|
|
||||||
|
|
||||||
result=$(nix-build -v \
|
result=$(nix-build -v \
|
||||||
--argstr revision "$revision" \
|
|
||||||
--argstr releaseName "$releaseName" \
|
--argstr releaseName "$releaseName" \
|
||||||
|
--argstr buildNumber "$buildNumber" \
|
||||||
--no-out-link \
|
--no-out-link \
|
||||||
release.nix \
|
release.nix \
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user