upload ci automation

This commit is contained in:
Jörg Thalheim 2021-06-10 08:10:06 +02:00
parent 312418d2f3
commit 5c2346f4b6
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4
4 changed files with 63 additions and 1 deletions

6
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

21
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: "Test"
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '51 2 * * 0'
jobs:
strategy:
matrix:
tag:
- nixos-21.05
- nixos-unstable
images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz
- name: Build image
run: ./build-images.sh "${{matrix.tag}}"

View file

@ -1 +1,3 @@
# nixos-images # nixos-images
Automatically build (netboot) images for NixOS.

33
build-images.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env nix-shell
#!nix-shell -p nix -p coreutils -p bash -p gh -i bash
set -xeuo pipefail
build_netboot_image() {
tag=$1
arch=$2
img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch")
echo $(readlink "$img/bzImage")
echo $(readlink "$img/initrd")
}
main() {
tag=${1:-nixos-unstable}
arch=${2:-x86_64-linux}
sha256s=()
tmp="$(mktemp -d)"
trap 'rm -rf -- "$tmp"' EXIT
assets=($(build_netboot_image "$tag" "$arch"))
for asset in "${assets[@]}"; do
pushd "$(dirname $asset)"
sha256sum "$(basename $asset)" > "$TMP/sha256sums"
popd
done
assets+=("$TMP/sha256sums")
# Since we cannot atomically update a release, we delete the old one before
gh release delete "$tag" </dev/null || true
gh release create --title "$tag (build $(date +"%Y-%m-%d"))" "$tag" "${assets[@]}" </dev/null
}
main "$@"