Skip to content

Merge pull request #5879 from IntersectMBO/sl/cardano-node-8.12 #67

Merge pull request #5879 from IntersectMBO/sl/cardano-node-8.12

Merge pull request #5879 from IntersectMBO/sl/cardano-node-8.12 #67

Workflow file for this run

name: Upload to ghci.io
on:
push:
tags:
- '**'
# GITHUB_SHA: Last commit in the tagged release
# GITHUB_REF: Tag ref of release refs/tags/<tag_name>
release:
types:
- published
# GITHUB_SHA: Last commit on the GITHUB_REF branch or tag
# GITHUB_REF: Branch or tag that received dispatch
workflow_dispatch: {}
env:
# Only to avoid some repetition
FLAKE_REF: github:${{ github.repository }}/${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}
# We need to tell skopeo where to write the authentication token
REGISTRY_AUTH_FILE: ./skopeo-registry-auth-file.json
jobs:
wait-for-hydra:
name: "Wait for hydra check-runs"
runs-on: ubuntu-latest
steps:
- name: Waiting for ci/hydra-build:required to complete
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
build:
needs: [wait-for-hydra]
name: "Upload to ghcr.io"
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: input-output-hk/install-nix-action@v20
- 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: Login to GitHub Container Registry
run: skopeo login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
# NOTE We assume that hydra has already built the image, this is
# reasonable since, before applying the tag, we must have already
# pushed the tagged commit somewhere, and Hydra will have had the
# change to build the image.
- name: Uploading intersectmbo/cardano-node
run: |
echo "::group::Downloading from cache"
nix build --accept-flake-config --print-out-paths --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#dockerImage/node
echo "::endgroup::"
echo "::group::Uploading to registry"
skopeo copy docker-archive:./result docker://ghcr.io/intersectmbo/cardano-node:$GITHUB_REF_NAME
echo "::endgroup::"
- name: Uploading intersectmbo/cardano-submit-api
run: |
echo "::group::Downloading from cache"
nix build --accept-flake-config --print-out-paths --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#dockerImage/submit-api
echo "::endgroup::"
echo "::group::Uploading to registry"
skopeo copy docker-archive:./result docker://ghcr.io/intersectmbo/cardano-submit-api:$GITHUB_REF_NAME
echo "::endgroup::"