diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index bfc20cd68..7cdc574fd 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -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 @@ -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 diff --git a/flake.nix b/flake.nix index b09d3b87e..1920b8cb8 100644 --- a/flake.nix +++ b/flake.nix @@ -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;