|
| 1 | +name: Upload to ghci.io |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '**' |
| 7 | + |
| 8 | +env: |
| 9 | + # Only to avoid some repetition |
| 10 | + FLAKE_REF: github:${{ github.repository }}/${{ github.ref_name }} |
| 11 | + # We need to tell skopeo where to write the authentication token |
| 12 | + REGISTRY_AUTH_FILE: ./skopeo-registry-auth-file.json |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: "Upload to ghcr.io" |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Install Nix |
| 20 | + uses: input-output-hk/install-nix-action@v20 |
| 21 | + |
| 22 | + - name: Display flake metadata |
| 23 | + id: flake-metadata |
| 24 | + run: | |
| 25 | + nix flake metadata ${{ env.FLAKE_REF }} |
| 26 | + nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT" |
| 27 | +
|
| 28 | + - name: Login to GitHub Container Registry |
| 29 | + run: skopeo login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io |
| 30 | + |
| 31 | + # NOTE We assume that hydra has already built the image, this is |
| 32 | + # reasonable since, before applying the tag, we must have already |
| 33 | + # pushed the tagged commit somewhere, and Hydra will have had the |
| 34 | + # change to build the image. |
| 35 | + |
| 36 | + - name: Uploading input-output-hk/cardano-node |
| 37 | + run: | |
| 38 | + echo "::group::Downloading from cache" |
| 39 | + nix build --accept-flake-config --print-out-paths --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#dockerImage/node |
| 40 | + echo "::endgroup::" |
| 41 | +
|
| 42 | + echo "::group::Uploading to registry" |
| 43 | + skopeo copy docker-archive:./result docker://ghcr.io/input-output-hk/cardano-node:$GITHUB_REF_NAME |
| 44 | + echo "::endgroup::" |
| 45 | +
|
| 46 | + - name: Uploading input-output-hk/cardano-submit-api |
| 47 | + run: | |
| 48 | + echo "::group::Downloading from cache" |
| 49 | + nix build --accept-flake-config --print-out-paths --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#dockerImage/submit-api |
| 50 | + echo "::endgroup::" |
| 51 | +
|
| 52 | + echo "::group::Uploading to registry" |
| 53 | + skopeo copy docker-archive:./result docker://ghcr.io/input-output-hk/cardano-submit-api:$GITHUB_REF_NAME |
| 54 | + echo "::endgroup::" |
0 commit comments