Release Upload #5
Workflow file for this run
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: Post Release Upload | |
# This makes it easy to get download release binaries built using | |
# a github action for any tagged commit. | |
# | |
# This workflow builds and uploads the macOS, win64 and linux | |
# binary packages as github assets. | |
# | |
# It uses `--builders "" --max-jobs 0` to ensure the assets are | |
# from the IOG cache. | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
push: | |
tags: | |
- '**' | |
env: | |
# Only to avoid some repetition | |
# TODO SHOULD BE LIKE THIS: | |
# FLAKE_REF: github:${{ github.repository }}/${{ github.ref_name }} | |
FLAKE_REF: github:${{ github.repository }}/6c57ef376ed84fa1d802c49e5aba0f0eac9d2d84 | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
wait-for-hydra: | |
name: "Wait for hydra check-runs" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get specific check run status | |
timeout-minutes: 120 | |
run: | | |
while [[ true ]]; do | |
# TODO SHOULD BE LIKE THIS: | |
# conclusion=$(gh api repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs --jq '.check_runs[] | select(.name == "ci/hydra-build:required") | .conclusion') | |
# TODO generalize | |
# When supporting other architectures than Linux, this query should be adapted: | |
conclusion=$(gh api repos/$GITHUB_REPOSITORY/commits/6c57ef376ed84fa1d802c49e5aba0f0eac9d2d84/check-runs --jq '.check_runs[] | select(.name | test("ci/hydra-build:.*-linux.required")) | .conclusion') | |
case "$conclusion" in | |
success) | |
echo "ci/hydra-build:required succeeded" | |
exit 0;; | |
failure) | |
echo "ci/hydra-build:required failed" | |
exit 1;; | |
*) | |
echo "ci/hydra-build:required pending. Waiting 30s..." | |
sleep 30;; | |
esac | |
done | |
pull: | |
needs: [wait-for-hydra] | |
strategy: | |
matrix: | |
arch: [linux] | |
# TODO generalize | |
# arch: [linux, macos, win64] | |
name: "Download Asset from the Cache" | |
runs-on: ubuntu-latest | |
steps: | |
- 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= | |
substituters = https://cache.iog.io/ https://cache.nixos.org/ | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Display flake metadata | |
id: flake-metadata | |
run: | | |
nix flake metadata ${{ env.FLAKE_REF }} | |
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT" | |
- name: Build | |
run: | | |
case ${{ matrix.arch }} in | |
linux) | |
nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#cardano-cli:exe:cardano-cli | |
cp result/bin/cardano-cli cardano-cli-${{ matrix.arch }} | |
;; | |
# TODO generalize | |
# Those need fixing, they have not been tested. But so far they are disabled, | |
# because the only platform tested on hydra is Linux (see flake.nix) | |
# macos) | |
# nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#cardano-cli:exe:cardano-cli | |
# tree result | |
# ;; | |
# win64) | |
# nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#x86_64-w64-mingw32:cardano-cli:exe:cardano-cli | |
# tree result | |
# ;; | |
esac | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.sha }}-${{ matrix.arch }} | |
path: cardano-cli-* | |
retention-days: 1 | |
# upload-assets: | |
# needs: [pull] | |
# name: "Upload Assets" | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: ${{ github.sha }}-linux | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: ${{ github.sha }}-macos | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: ${{ github.sha }}-win64 | |
# - name: Release | |
# uses: input-output-hk/action-gh-release@v1 | |
# with: | |
# draft: true | |
# files: | | |
# cardano-node-*-win64.zip | |
# cardano-node-*-macos.tar.gz | |
# cardano-node-*-linux.tar.gz |