release 2024-01-17 #82
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 bootstrap installer | |
on: | |
push: | |
tags: | |
- 'release-*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v18 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.13.2/install | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
# save space on disk and in cache | |
auto-optimise-store = true | |
# keep all store paths necessary to build the outputs | |
keep-outputs = true | |
keep-derivations = true | |
- name: cache nix store | |
id: cache-nix-store | |
uses: actions/cache@v3 | |
with: | |
key: installer5-${{ github.sha }} | |
restore-keys: | | |
installer5 | |
path: | | |
nix_store_dir | |
nix_store_db.sqlite | |
- name: restore cached nix store | |
run: | | |
if [ -e nix_store_db.sqlite ]; then | |
sudo systemctl stop nix-daemon | |
# put cached store paths back in their proper locations | |
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 store 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 installer | |
run: | | |
nix build --extra-experimental-features 'nix-command flakes' .#installer-bootstrap -j2 -L | |
cp result/iso/*.iso $(basename result/iso/*.iso | sed s/aarch64-linux/apple-silicon-${{ github.ref_name }}/) | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: installer | |
path: ./*.iso | |
- uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./*.iso | |
- name: prepare nix store for caching | |
run: | | |
# delete old stuff not relevant to this build | |
nix-collect-garbage | |
sudo systemctl stop nix-daemon | |
# move store to a place where the cache action can read it | |
sudo mv /nix/store nix_store_dir | |
sudo mv /nix/var/nix/db/db.sqlite nix_store_db.sqlite | |