Skip to content

Commit fbe2ff2

Browse files
authored
Merge pull request #5342 from input-output-hk/hkm/upload-to-ghcr-2
Upload to ghcr.io
2 parents 2d0fde1 + c558582 commit fbe2ff2

File tree

2 files changed

+59
-9
lines changed

2 files changed

+59
-9
lines changed

.github/workflows/release-ghcr.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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::"

flake.nix

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,18 +366,14 @@
366366
inherit config system overlays;
367367
};
368368
inherit (mkFlakeAttrs pkgs) environments packages checks apps project ciJobs devShells workbench;
369-
# We use a generic gitrev for PR CI to avoid unecessary rebuilds:
370-
ciJobsPrs = (mkFlakeAttrs (pkgs.extend (prev: final: { gitrev = "0000000000000000000000000000000000000000"; }))).ciJobs;
371369
in
372370
{
373371

374-
inherit environments checks project ciJobsPrs devShells workbench;
372+
inherit environments checks project ciJobs devShells workbench;
375373

376374
legacyPackages = pkgs // {
377375
# allows access to hydraJobs without specifying <arch>:
378-
hydraJobs = ciJobs // {
379-
pr = ciJobsPrs;
380-
};
376+
hydraJobs = ciJobs;
381377
};
382378

383379
packages = packages // {
@@ -394,11 +390,11 @@
394390
);
395391

396392
in
397-
removeAttrs flake [ "ciJobsPrs" ] // {
393+
removeAttrs flake [ "ciJobs" ] // {
398394

399-
hydraJobs = flake.ciJobsPrs // (let pkgs = self.legacyPackages.${defaultSystem}; in {
395+
hydraJobs = flake.ciJobs // (let pkgs = self.legacyPackages.${defaultSystem}; in {
400396
inherit (pkgs.callPackages iohkNix.utils.ciJobsAggregates {
401-
ciJobs = lib.mapAttrs (_: lib.getAttr "required") flake.ciJobsPrs // {
397+
ciJobs = lib.mapAttrs (_: lib.getAttr "required") flake.ciJobs // {
402398
# ensure hydra notify:
403399
gitrev = pkgs.writeText "gitrev" pkgs.gitrev;
404400
};

0 commit comments

Comments
 (0)