Skip to content

Commit

Permalink
Merge pull request #24 from serokell/rvem/#11-auto-binary-releases
Browse files Browse the repository at this point in the history
[#11] Add autorelease script
  • Loading branch information
yorickvP authored Jan 14, 2020
2 parents 5bd36a3 + 70dca02 commit 051cfb4
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ steps:
- ./mainnet-deb-package/*
- ./babylonnet-rpm-package/*
- ./babylonnet-deb-package/*
branches: !master
- commands:
- GITHUB_TOKEN=$(cat ~/niv-bot-token) ./scripts/autorelease.sh
label: create auto pre-release
branches: master
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ make rpm-mainnet #build rpm package with tezos-client-mainnet
To build `.rpm` package with `mainnet` or `babylonnet` `tezos-client` executable. Once you install
such package the command `tezos-client-mainnet` or `tezos-client-babylonnet` will be available.

## Obtain binary or packages from CI
## Obtain binary or packages from github release

If you don't want to build these files from scratch, you can download artifacts
produced by the CI. Go to the [latest master build](https://buildkite.com/serokell/tezos-packaging/builds/latest?branch=master),
click on `build and package` stage, choose `Artifacts` section and download files by clcking on the filenames.
If you don't want to build these files from scratch, you can download assets from github release.
Go to the [latest release](https://github.com/serokell/tezos-packaging/releases/latest)
and download desired assets.

## Ubuntu (Debian based distros) usage

Expand Down
15 changes: 12 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ let
tezos-client-static-babylonnet = import ./nix/static.nix babylonnet;
binary-mainnet = "${tezos-client-static-mainnet}/bin/tezos-client";
binary-babylonnet = "${tezos-client-static-babylonnet}/bin/tezos-client";
# Hopefully, there will always be a single LICENSE for all binaries and branches
licenseFile = "${tezos-client-static-mainnet}/LICENSE";
packageDesc-mainnet = {
inherit licenseFile;
project = "tezos-client-mainnet";
version = toString timestamp;
bin = binary-mainnet;
arch = "amd64";
license = "MIT";
dependencies = "";
maintainer = "Serokell https://serokell.io";
licenseFile = "${tezos-client-static-mainnet}/LICENSE";
description = "CLI client for interacting with tezos blockchain";
gitRevision = mainnet.rev;
branchName = "mainnet";
Expand All @@ -38,7 +40,6 @@ let
project = "tezos-client-babylonnet";
bin = binary-babylonnet;
gitRevision = babylonnet.rev;
licenseFile = "${tezos-client-static-babylonnet}/LICENSE";
branchName = "babylonnet";
};

Expand Down Expand Up @@ -71,8 +72,16 @@ let
cp ${binary-babylonnet} $out/${name}
'';
};
tezos-license = stdenv.mkDerivation rec {
name = "LICENSE";
phases = "copyPhase";
copyPhase = ''
mkdir -p $out
cp ${licenseFile} $out/${name}
'';
};

in rec {
inherit tezos-client-mainnet tezos-client-babylonnet mainnet-deb-package
mainnet-rpm-package babylonnet-rpm-package babylonnet-deb-package;
mainnet-rpm-package babylonnet-rpm-package babylonnet-deb-package tezos-license;
}
11 changes: 11 additions & 0 deletions release.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2019 TQ Tezos <https://tqtezos.com/>
#
# SPDX-License-Identifier: MPL-2.0
{ pkgs ? import <nixpkgs> { }, timestamp ? "19700101" }:
let closures = builtins.attrValues (import ./. { inherit pkgs timestamp; });
in pkgs.runCommandNoCC "release" { inherit closures; } ''
mkdir -p $out
for closure in $closures; do
cp $closure/* $out/
done
''
31 changes: 31 additions & 0 deletions scripts/autorelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env nix-shell
#!nix-shell -p gitAndTools.hub git -i bash
# SPDX-FileCopyrightText: 2019 TQ Tezos <https://tqtezos.com/>
#
# SPDX-License-Identifier: MPL-2.0

# Project name, inferred from repository name
project=$(basename $(pwd))

# The directory in which artifacts will be created
TEMPDIR=`mktemp -d`

# Build release.nix
nix-build release.nix -o $TEMPDIR/$project --arg timestamp $(date +\"%Y%m%d%H%M\")

# Delete release
hub release delete auto-release

# Update the tag
git fetch # So that the script can be run from an arbitrary checkout
git tag -f auto-release
git push --force --tags

# Combine all assets
assets=""
for file in $TEMPDIR/$project/*; do
assets+="-a $file "
done

# Create release
hub release create $assets -m "Automatic build on $(date -I)" --prerelease auto-release

0 comments on commit 051cfb4

Please sign in to comment.