This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
8.3.1 #1
Workflow file for this run
This file contains 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: 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 input-output-hk/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/input-output-hk/cardano-node:$GITHUB_REF_NAME | |
echo "::endgroup::" | |
- name: Uploading input-output-hk/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/input-output-hk/cardano-submit-api:$GITHUB_REF_NAME | |
echo "::endgroup::" |