release 2024-02-24 #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build ISO image | |
on: | |
push: | |
tags: | |
- '*' # only run when we are tagged | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: install nix | |
uses: cachix/install-nix-action@v25 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
auto-optimise-store = true | |
keep-outputs = true | |
keep-derivations = true | |
- name: cache the nix store | |
uses: actions/cache@v4 | |
with: | |
key: isobuilder-${{ github.sha }} | |
restore-keys: | | |
isobuilder | |
path: | | |
nix_store_dir | |
nix_store_db.sqlite | |
- name: restore the cached nix store | |
run: | | |
if [ -e nix_store_db.sqlite ]; then | |
sudo systemctl stop nix-daemon | |
# put cached store paths back | |
sudo rm -rf /nix/store /nix/var/nix/db/db.sqlite | |
sudo mv nix_store_dir /nix/store | |
sudo cp nix_store_db.sqlite /nix/var/nix/db/db.sqlite | |
# fix permissions | |
sudo chmod 1775 /nix/store | |
sudo chown root:nixbld /nix/store | |
sudo chmod 0644 /nix/var/nix/db/db.sqlite | |
sudo chown -R root:root /nix/store /nix/var/nix/db/db.sqlite | |
sudo systemctl start nix-daemon | |
fi | |
- name: build iso | |
run: | | |
nix build --extra-experimental-features 'nix-command flakes' -j2 -L | |
cp result/iso/*.iso $(basename result/iso/*.iso | sed s/x86_64-linux/amd64-${{ github.ref_name }}/) | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
path: ./*.iso | |
# this will only run if we have a tagged commit | |
- name: create the github release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./*.iso | |
- name: prepare nix store for caching | |
run: | | |
nix-collect-garbage | |
sudo systemctl stop nix-daemon | |
sudo mv /nix/store nix_store_dir | |
sudo mv /nix/var/nix/db/db.sqlite nix_store_db.sqlite |