ci: try not to build the kernel over and over again #164
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: CI | |
on: | |
push: | |
paths-ignore: | |
- "**.md" | |
branches: | |
- 'main' | |
# this is needed when pushing tags manually, apparently. | |
# https://github.com/actions/runner/issues/1007 | |
create: | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
branches-ignore: | |
- 'dependabot/*' | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: CI | |
steps: | |
- name: Maximize build space | |
uses: AdityaGarg8/remove-unwanted-software@master | |
with: | |
remove-android: 'true' | |
remove-dotnet: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
remove-large-packages: 'true' | |
remove-cached-tools: 'true' | |
remove-swapfile: 'true' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Install Nix" | |
uses: cachix/install-nix-action@v30 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.18.4/install | |
- name: "Set Up Binary Cache" | |
uses: cachix/cachix-action@v15 | |
with: | |
name: t2linux | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
pushFilter: "(squashfs.img$|x86_64-linux.iso$)" | |
- name: Build | |
env: | |
GC_DONT_GC: 1 | |
run: | | |
for output in $(nix flake show --json | nix run nixpkgs#jq -- -r 'keys[]'); do | |
nix build .#$output --accept-flake-config | |
if [ $(du -B1M result/iso/*.iso | cut -f1) -gt 2000 ]; then | |
split -d result/iso/*.iso -b 2000M nixos-$output.iso.part- | |
else | |
cp result/iso/*.iso nixos-$output.iso | |
fi | |
rm result | |
done | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: "nixos-*.iso*" |