|
| 1 | +name: Post Release Upload |
| 2 | +# This makes it easy to get download release binaries built using |
| 3 | +# a github action for any tagged commit. |
| 4 | +# |
| 5 | +# This workflow builds and uploads the linux |
| 6 | +# binary packages as github assets. |
| 7 | +# |
| 8 | +# It uses `--builders "" --max-jobs 0` to ensure the assets are |
| 9 | +# from the IOG cache. |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + release: |
| 13 | + types: |
| 14 | + - published |
| 15 | + push: |
| 16 | + tags: |
| 17 | + - '**' |
| 18 | +env: |
| 19 | + # Only to avoid some repetition |
| 20 | + FLAKE_REF: github:${{ github.repository }}/${{ github.ref_name }} |
| 21 | + GH_TOKEN: ${{ github.token }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + wait-for-hydra: |
| 25 | + name: "Wait for hydra check-runs" |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - name: Waiting for ci/hydra-build:x86_64-linux.required to complete |
| 29 | + run: | |
| 30 | + while [[ true ]]; do |
| 31 | + check_name='ci/hydra-build:x86_64-linux.required' |
| 32 | + conclusion=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs?check_name=$check_name" --paginate --jq '.check_runs[].conclusion') |
| 33 | + case "$conclusion" in |
| 34 | + success) |
| 35 | + echo "$check_name succeeded" |
| 36 | + exit 0;; |
| 37 | + '') |
| 38 | + echo "$check_name pending. Waiting 30s..." |
| 39 | + sleep 30;; |
| 40 | + *) |
| 41 | + echo "$check_name terminated unsuccessfully" |
| 42 | + exit 1;; |
| 43 | + esac |
| 44 | + done |
| 45 | +
|
| 46 | + pull: |
| 47 | + needs: [wait-for-hydra] |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + arch: [linux] |
| 51 | + name: "Download Asset from the Cache" |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Install Nix with good defaults |
| 55 | + uses: input-output-hk/install-nix-action@v20 |
| 56 | + with: |
| 57 | + extra_nix_config: | |
| 58 | + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= |
| 59 | + substituters = https://cache.iog.io/ https://cache.nixos.org/ |
| 60 | + experimental-features = nix-command flakes fetch-closure |
| 61 | + allow-import-from-derivation = true |
| 62 | + accept-flake-config = true |
| 63 | + nix_path: nixpkgs=channel:nixos-unstable |
| 64 | + |
| 65 | + - name: Checkout repository |
| 66 | + uses: actions/checkout@v3 |
| 67 | + |
| 68 | + - name: Build |
| 69 | + run: | |
| 70 | + case ${{ matrix.arch }} in |
| 71 | + linux) |
| 72 | + nix build \ |
| 73 | + --builders "" \ |
| 74 | + --max-jobs 0 \ |
| 75 | + .#packages.x86_64-linux.dmq-node-static |
| 76 | + cp result/dmq-node.tar.gz . |
| 77 | + esac |
| 78 | +
|
| 79 | + - uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: ${{ github.sha }}-${{ matrix.arch }} |
| 82 | + path: dmq-node.* |
| 83 | + retention-days: 1 |
| 84 | + |
| 85 | + - name: Release |
| 86 | + uses: input-output-hk/action-gh-release@v1 |
| 87 | + with: |
| 88 | + draft: true |
| 89 | + files: | |
| 90 | + dmq-node.tar.gz |
0 commit comments