Release upload #3
Workflow file for this run
This file contains hidden or 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 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: Waiting for ci/hydra-build:x86_64-linux.required to complete | |
| run: | | |
| while [[ true ]]; do | |
| check_name='ci/hydra-build:x86_64-linux.required' | |
| conclusion=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs?check_name=$check_name" --paginate --jq '.check_runs[].conclusion') | |
| case "$conclusion" in | |
| success) | |
| echo "$check_name succeeded" | |
| exit 0;; | |
| '') | |
| echo "$check_name pending. Waiting 30s..." | |
| sleep 30;; | |
| *) | |
| echo "$check_name terminated unsuccessfully" | |
| exit 1;; | |
| esac | |
| done | |
| pull: | |
| needs: [wait-for-hydra] | |
| strategy: | |
| matrix: | |
| arch: [linux] | |
| 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 }}#packages.x86_64-linux.dmq-node-static | |
| cp result/dmq-node-*-*-*.tar.gz . | |
| ;; | |
| esac | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.sha }}-${{ matrix.arch }} | |
| path: dmq-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-darwin.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 "dmq-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 dmq-node-* >> "$sha256sums_filename" | |
| - name: Release | |
| uses: input-output-hk/action-gh-release@v1 | |
| with: | |
| draft: true | |
| files: | | |
| dmq-node-*-linux.tar.gz | |
| dmq-node-*-sha256sums.txt |