@@ -8,16 +8,46 @@ name: Post Release Upload
8
8
# It uses `--builders "" --max-jobs 0` to ensure the assets are
9
9
# from the IOG cache.
10
10
on :
11
+ workflow_dispatch :
11
12
release :
12
13
types :
13
14
- published
14
15
push :
15
16
tags :
16
17
- ' **'
18
+ env :
19
+ # Only to avoid some repetition
20
+ FLAKE_REF : github:${{ github.repository }}/${{ github.ref_name }}
21
+ GH_TOKEN : ${{ github.token }}
17
22
18
23
jobs :
19
- build :
20
- name : " Upload Assets"
24
+ wait-for-hydra :
25
+ name : " Wait for hydra check-runs"
26
+ runs-on : ubuntu-latest
27
+ steps :
28
+ - name : Get specific check run status
29
+ run : |
30
+ while [[ true ]]; do
31
+ conclusion=$(gh api repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs --jq '.check_runs[] | select(.name == "ci/hydra-build:required") | .conclusion')
32
+ case "$conclusion" in
33
+ success)
34
+ echo "ci/hydra-build:required succeeded"
35
+ exit 0;;
36
+ failure)
37
+ echo "ci/hydra-build:required failed"
38
+ exit 1;;
39
+ *)
40
+ echo "ci/hydra-build:required pending. Waiting 30s..."
41
+ sleep 30;;
42
+ esac
43
+ done
44
+
45
+ pull :
46
+ needs : [wait-for-hydra]
47
+ strategy :
48
+ matrix :
49
+ arch : [linux, macos, win64]
50
+ name : " Download Asset from the Cache"
21
51
runs-on : ubuntu-latest
22
52
steps :
23
53
- name : Install Nix with good defaults
@@ -27,16 +57,47 @@ jobs:
27
57
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
28
58
substituters = https://cache.iog.io/ https://cache.nixos.org/
29
59
nix_path : nixpkgs=channel:nixos-unstable
30
- - name : Checkout repository
31
- uses : actions/checkout@v3
60
+ - name : Display flake metadata
61
+ id : flake-metadata
62
+ run : |
63
+ nix flake metadata ${{ env.FLAKE_REF }}
64
+ nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT"
32
65
- name : Build
33
66
run : |
34
- nix build --builders "" --max-jobs 0 .#hydraJobs.musl.cardano-node-linux
35
- cp result/cardano-node-*-linux.tar.gz .
36
- nix build --builders "" --max-jobs 0 .#legacyPackages.x86_64-darwin.hydraJobs.native.cardano-node-macos
37
- cp result/cardano-node-*-macos.tar.gz .
38
- nix build --builders "" --max-jobs 0 .#hydraJobs.windows.cardano-node-win64
39
- cp result/cardano-node-*-win64.zip .
67
+ case ${{ matrix.arch }} in
68
+ linux)
69
+ nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.musl.cardano-node-linux
70
+ cp result/cardano-node-*-*.tar.gz .
71
+ ;;
72
+ macos)
73
+ nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.native.cardano-node-macos
74
+ cp result/cardano-node-*-*.tar.gz .
75
+ ;;
76
+ win64)
77
+ nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.windows.cardano-node-win64
78
+ cp result/cardano-node-*-*.zip .
79
+ ;;
80
+ esac
81
+ - uses : actions/upload-artifact@v3
82
+ with :
83
+ name : ${{ github.sha }}-${{ matrix.arch }}
84
+ path : cardano-node-*-*.*
85
+ retention-days : 1
86
+
87
+ upload-assets :
88
+ needs : [pull]
89
+ name : " Upload Assets"
90
+ runs-on : ubuntu-latest
91
+ steps :
92
+ - uses : actions/download-artifact@v3
93
+ with :
94
+ name : ${{ github.sha }}-linux
95
+ - uses : actions/download-artifact@v3
96
+ with :
97
+ name : ${{ github.sha }}-macos
98
+ - uses : actions/download-artifact@v3
99
+ with :
100
+ name : ${{ github.sha }}-win64
40
101
- name : Release
41
102
uses : input-output-hk/action-gh-release@v1
42
103
with :
0 commit comments