Add CI action to publish custom-branch hydra-node docker images (#1756) #3535
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
# Build distributable executables and prime nix caches with development shells. | |
name: Binaries & devShells | |
on: | |
push: | |
branches: | |
- master | |
- release | |
tags: | |
- "*.*.*" | |
jobs: | |
build-linux: | |
name: "Build for x86_64-linux" | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# Also ensure we have all history with all tags | |
fetch-depth: 0 | |
- name: β Prepare nix | |
uses: cachix/install-nix-action@v30 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
log-lines = 1000 | |
- name: β Cachix cache of nix derivations | |
uses: cachix/cachix-action@v15 | |
with: | |
name: cardano-scaling | |
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' | |
- name: π΅ Determine version | |
run: | | |
# NOTE: For some reason the fetched tags on checkout are not effective | |
# and we need to refetch with --force for git describe. | |
git fetch --tags --force | |
echo "VERSION=$(git describe --always HEAD)" | tee "$GITHUB_ENV" | |
- name: β Build static executables | |
# Produces static ELF binary for using MuslC which includes all needed | |
# libraries statically linked into it. | |
run: | | |
nix build .#release-static | |
# XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 | |
unzip result/*.zip -d out | |
- name: πΎ Upload executables | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hydra-x86_64-linux-${{ env.VERSION }} # automatically zips | |
path: out/* | |
build-macos: | |
name: "Build for aarch64-darwin" | |
runs-on: macos-latest | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# Also ensure we have all history with all tags | |
fetch-depth: 0 | |
- name: β Prepare nix | |
uses: cachix/install-nix-action@v30 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
log-lines = 1000 | |
- name: β Cachix cache of nix derivations | |
uses: cachix/cachix-action@v15 | |
with: | |
name: cardano-scaling | |
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' | |
- name: π΅ Determine version | |
run: | | |
# NOTE: For some reason the fetched tags on checkout are not effective | |
# and we need to refetch with --force for git describe. | |
git fetch --tags --force | |
echo "VERSION=$(git describe --always HEAD)" | tee "$GITHUB_ENV" | |
- name: β Build executables | |
# Produces a dynamic Mach-O binary which is still dynamically linked against | |
# system dependencies, but all third-party libraries are statically linked. | |
run: | | |
nix build .#release | |
# XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 | |
unzip result/*.zip -d out | |
- name: πΎ Upload executables | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hydra-aarch64-darwin-${{ env.VERSION }} # automatically zips | |
path: out/* |