64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: build and cache packages
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
package:
|
|
description: "package to build"
|
|
required: false
|
|
type: string
|
|
env:
|
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
|
NIX_CONFIG: |
|
|
show-trace = true
|
|
extra-substituters = https://cache.cy7.sh/main
|
|
extra-trusted-public-keys = main:Ku31HoEWcBtfggge2VGj+QTkVrQuIwRIMGyfV/5VQP0=
|
|
experimental-features = nix-command flakes
|
|
extra-experimental-features = nix-command flakes
|
|
accept-flake-config = true
|
|
TERM: ansi
|
|
|
|
jobs:
|
|
build-packages:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
package:
|
|
- ${{ inputs.package }}
|
|
os:
|
|
- ubuntu-latest
|
|
- ubuntu-24.04-arm
|
|
- macos-latest
|
|
- macos-13
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install Nix
|
|
uses: cachix/install-nix-action@v30
|
|
|
|
- name: Sync repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: setup attic
|
|
run: |
|
|
nix profile install github:zhaofengli/attic
|
|
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
|
|
|
|
- run: nix build -L ${{ matrix.package }}
|
|
|
|
- name: cache result
|
|
run: |
|
|
derivation="$(nix path-info --derivation "${{ matrix.package }}")"
|
|
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
|
|
attic push main --stdin <<< "$cache"
|
|
|
|
- name: prepare tarball to upload
|
|
run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result
|
|
|
|
- name: upload result
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.os }}
|
|
path: result.tar
|
|
if-no-files-found: error
|