-
Notifications
You must be signed in to change notification settings - Fork 722
112 lines (109 loc) · 4.04 KB
/
release-upload.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
FLAKE_REF: github:${{ github.repository }}/${{ github.ref_name }}
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
run: |
while [[ true ]]; do
conclusion=$(gh api repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs --jq '.check_runs[] | select(.name == "ci/hydra-build: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, 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 }}#hydraJobs.x86_64-linux.musl.cardano-node-linux
cp result/cardano-node-*-*.tar.gz .
;;
macos)
nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.native.cardano-node-macos
cp result/cardano-node-*-*.tar.gz .
;;
win64)
nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.windows.cardano-node-win64
cp result/cardano-node-*-*.zip .
;;
esac
- uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.arch }}
path: cardano-node-*-*.*
retention-days: 1
upload-assets:
needs: [pull]
name: "Upload Assets"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Checksums
run: |
# find returns something like this:
# "cardano-node-8.11.0-linux.tar.gz cardano-node-8.11.0-macos.tar.gz ..."
# We use the first member of this list to compute the prefix "cardano-node-8.11.0"
first_archive=$(find . -maxdepth 1 -name "cardano-node-*" -printf '%P\n' | head -n 1)
# Then we trim the architecture-specific suffix (last "-" and after)
sha256sums_filename=$(echo "${first_archive%-*}-sha256sums.txt")
sha256sum cardano-node-* >> "$sha256sums_filename"
- 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
cardano-node-*-sha256sums.txt