Update private #379
This file contains hidden or 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 and Release NixOS ISO | |
on: | |
push: | |
branches: main | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free up some disk space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Implement https://github.com/jlumbroso/free-disk-space/pull/24 | |
run: | | |
sudo apt-get purge --auto-remove -y snapd microsoft-edge-stable '^temurin-.*' '^.*jdk.*' '^.*jre.*' --fix-missing | |
sudo rm -rf /usr/local /usr/share | |
# Create with liberal rights, otherwise cache action will complain | |
# about permission errors. | |
- run: sudo mkdir -p /nix/store && sudo chmod -R 777 /nix | |
- name: Set up cache for /nix/store | |
uses: actions/cache@v4 | |
with: | |
path: | | |
# See https://github.com/actions/cache/pull/726 | |
/nix/store/** | |
# Missing something? | |
/nix/var/nix/*/* | |
/nix/var/nix/db/* | |
/nix/var/nix/db/*/** | |
!/nix/var/nix/daemon-socket/socket | |
!/nix/var/nix/userpool/* | |
!/nix/var/nix/gc.lock | |
!/nix/var/nix/db/big-lock | |
!/nix/var/nix/db/reserved | |
key: ${{ runner.os }}-nix-store | |
- name: Install Nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Run Garbage Collector | |
run: nix-collect-garbage -d | |
- name: Build the ISO image | |
run: nix build .#nixosConfigurations.iso.config.system.build.isoImage | |
- name: Generate tag name | |
id: tag | |
run: echo "name=$(ls result/iso/ | sed -E 's/.*\.([[:alnum:]]+)\.iso$/iso-\1/')" >> $GITHUB_OUTPUT | |
- uses: oras-project/setup-oras@v1 | |
- run: | | |
cd result/iso | |
oras login ghcr.io -u github -p ${{ secrets.GITHUB_TOKEN }} | |
oras push ghcr.io/${{ github.repository }}/nixos-iso:${{ steps.tag.outputs.name }},latest *.iso | |
# Let gh cache as the created files are not owned by us | |
- run: sudo chmod -R 777 /nix |