Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions .github/workflows/release-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ on:
release:
types:
- published
push:
tags:
- '**'
push: {}
workflow_dispatch: {}
schedule:
# Everyday at 4:00 AM UTC
- cron: "0 4 * * *"

env:
REGISTRY: ghcr.io
GH_TOKEN: ${{ github.token }}

jobs:
build:
name: "Upload to ghcr.io"
name: "Build image"
runs-on: ubuntu-latest
steps:
- name: Install Nix with good defaults
Expand Down Expand Up @@ -51,32 +53,52 @@ jobs:
echo "REPO_OWNER=${REPO_OWNER}" >> "$GITHUB_ENV"
echo "IMAGE_TAG=${IMAGE_TAG}" >> "$GITHUB_ENV"

- name: Upload ${{ github.actor }}/cardano-db-sync
- name: Wait for Hydra
uses: input-output-hk/actions/wait-for-hydra@latest
with:
check: ci/hydra-build:x86_64-linux.required

- name: Load images
run: |
# Download the image from the nix binary cachhe
nix build --builders "" --max-jobs 0 .#cardano-db-sync-docker
# Download the images from the nix binary cachhe
nix build \
--builders "" \
--max-jobs 0 \
--out-link result-cardano-db-sync \
.#cardano-db-sync-docker

nix build \
--builders "" \
--max-jobs 0 \
--out-link result-cardano-smash-server \
.#cardano-smash-server-docker

# REMOVEME: debugging
echo "ref_type=${{ github.ref_type }}"
echo "event_name=${{ github.event_name }}"

- name: Upload ${{ github.actor }}/cardano-db-sync
if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }}
run: |
# Push the image
skopeo copy \
docker-archive:./result \
docker-archive:./result-cardano-db-sync \
docker://ghcr.io/${REPO_OWNER}/cardano-db-sync:$IMAGE_TAG

# Also tag it as latest
skopeo copy \
docker-archive:./result \
docker-archive:./result-cardano-db-sync \
docker://ghcr.io/${REPO_OWNER}/cardano-db-sync:latest

- name: Upload ${{ github.actor }}/cardano-smash-server
if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }}
run: |
# Download the image from the nix binary cachhe
nix build --builders "" --max-jobs 0 .#cardano-smash-server-docker

# Push the image
skopeo copy \
docker-archive:./result \
docker-archive:./result-cardano-smash-server \
docker://ghcr.io/${REPO_OWNER}/cardano-smash-server:$IMAGE_TAG

# Also tag it as latest
skopeo copy \
docker-archive:./result \
docker-archive:./result-cardano-smash-server \
docker://ghcr.io/${REPO_OWNER}/cardano-smash-server:latest
27 changes: 15 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,26 @@
nonRequiredMacOSPaths
else [];

extraCiJobs =
lib.optionalAttrs (system == "x86_64-linux") {
inherit
cardano-db-sync-linux
cardano-db-sync-docker
cardano-smash-server-docker;
} // lib.optionalAttrs (system == "x86_64-darwin") {
inherit cardano-db-sync-macos;
} // {
inherit cardano-smash-server-no-basic-auth;
checks = staticChecks;
};

in rec {
checks = staticChecks;

hydraJobs = callPackages inputs.iohkNix.utils.ciJobsAggregates {
ciJobs = flake.hydraJobs;
ciJobs = flake.hydraJobs // extraCiJobs;
nonRequiredPaths = map lib.hasPrefix nonRequiredPaths;
} // lib.optionalAttrs (system == "x86_64-linux") {
inherit
cardano-db-sync-linux
cardano-db-sync-docker
cardano-smash-server-docker;
} // lib.optionalAttrs (system == "x86_64-darwin") {
inherit cardano-db-sync-macos;
} // {
inherit cardano-smash-server-no-basic-auth;
checks = staticChecks;
};
} // extraCiJobs;

legacyPackages = pkgs;

Expand Down