upload ci automation
This commit is contained in:
parent
312418d2f3
commit
5c2346f4b6
4 changed files with 63 additions and 1 deletions
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
21
.github/workflows/build.yml
vendored
Normal file
21
.github/workflows/build.yml
vendored
Normal 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}}"
|
|
@ -1 +1,3 @@
|
|||
# nixos-images
|
||||
# nixos-images
|
||||
|
||||
Automatically build (netboot) images for NixOS.
|
||||
|
|
33
build-images.sh
Executable file
33
build-images.sh
Executable 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 "$@"
|
Loading…
Reference in a new issue