With Kupo, and others #84
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: Wait for Hydra Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*" | |
pull_request: | |
env: | |
FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }} | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
wait-for-hydra: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Nix with good defaults | |
uses: input-output-hk/install-nix-action@v20 | |
with: | |
extra_nix_config: | | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= | |
substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Display flake metadata | |
id: flake-metadata | |
run: | | |
echo $PWD | |
ls -lah . | |
nix flake metadata ${{ env.FLAKE_REF }} | |
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT" | |
- name: Wait for nix-tools meta job | |
uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs | |
with: | |
status: 'ci/hydra-build:nix-tools' | |
- name: "Pull nix-tools" | |
run: | | |
ls -lah . | |
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.aarch64-darwin.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | |
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | |
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | |
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools-static-arm64-no-ifd --no-link --print-out-paths)/*.zip . | |
- name: Configure Git | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git config --global user.name 'Auto Update Bot' | |
git config --global user.email '[email protected]' | |
- name: "Compute default.nix" | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git fetch --all | |
git switch --force nix | |
( | |
echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell-nix-example/releases/download/${GITHUB_REF_NAME}/\"; in {" | |
for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do | |
echo " ${arch} = pkgs.fetchurl { " | |
echo " name = \"${arch}-nix-tools-static\";" | |
echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";" | |
echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";" | |
echo " };" | |
done | |
echo "}" | |
) > default.nix | |
cat default.nix | |
- name: Push to nix branch | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git add default.nix | |
git commit -m "update default.nix" | |
git push origin nix | |
- name: Release | |
uses: input-output-hk/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
*-nix-tools-static.zip |