diff --git a/.github/workflows/push-build.yaml b/.github/workflows/push-build.yaml index 81af09b2d..7e17763a1 100644 --- a/.github/workflows/push-build.yaml +++ b/.github/workflows/push-build.yaml @@ -20,7 +20,8 @@ permissions: jobs: push-image-to-container-registry: runs-on: ubuntu-22.04 - if: github.repository == 'rook/rook' + # Run in upstream rook/rook or fork subhamkrai/rook + if: github.repository == 'rook/rook' || github.repository == 'subhamkrai/rook' steps: - name: checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -95,6 +96,15 @@ jobs: BRANCH_NAME: ${{ env.BRANCH_NAME }} AWS_USR: ${{ secrets.AWS_USR }} AWS_PSW: ${{ secrets.AWS_PSW }} - GITHUB_REF: $ {{ env.GITHUB_REF }} + GITHUB_REF: ${{ env.GITHUB_REF }} run: | + # Fork: push only to GHCR (no Docker Hub/Quay). Upstream unchanged. + if [ "${{ github.repository }}" != "rook/rook" ]; then + export GHCR_REGISTRY="ghcr.io/${{ github.repository_owner }}" + export DOCKER_REGISTRY="ghcr.io/${{ github.repository_owner }}" + export QUAY_REGISTRY="ghcr.io/${{ github.repository_owner }}" + export REGISTRIES="ghcr.io/${{ github.repository_owner }}" + [ -n "${{ secrets.S3_BUCKET_FORK }}" ] && export S3_BUCKET="${{ secrets.S3_BUCKET_FORK }}" + [ -n "${{ secrets.HELM_S3_BUCKET_FORK }}" ] && export HELM_S3_BUCKET="${{ secrets.HELM_S3_BUCKET_FORK }}" + fi tests/scripts/build-release.sh diff --git a/build/release/Makefile b/build/release/Makefile index eb7e6b718..6e8c4958e 100644 --- a/build/release/Makefile +++ b/build/release/Makefile @@ -56,6 +56,8 @@ FLAVORS ?= output images docs helm charts DOCKER_REGISTRY ?= docker.io/rook QUAY_REGISTRY ?= quay.io/rook GHCR_REGISTRY ?= ghcr.io/rook +# Allow override from env (e.g. fork: REGISTRIES=ghcr.io/owner) +ifeq ($(origin REGISTRIES),undefined) ifeq ($(TAGGED_RELEASE),false) # Publish always to dockerhub, including master and interim builds REGISTRIES = $(DOCKER_REGISTRY) @@ -63,6 +65,7 @@ else # Publish the images to all registries for tagged releases REGISTRIES = $(DOCKER_REGISTRY) $(QUAY_REGISTRY) $(GHCR_REGISTRY) endif +endif IMAGE_ARCHS := $(subst linux_,,$(filter linux_%,$(PLATFORMS))) IMAGE_PLATFORMS := $(subst _,/,$(subst $(SPACE),$(COMMA),$(filter linux_%,$(PLATFORMS)))) IMAGE_PLATFORMS_COMMA := $(shell echo "$(IMAGE_PLATFORMS)" | sed 's/ /,/g' | sed 's/.$$//') diff --git a/tests/scripts/build-release.sh b/tests/scripts/build-release.sh index a193c287e..7fb77da32 100755 --- a/tests/scripts/build-release.sh +++ b/tests/scripts/build-release.sh @@ -36,9 +36,17 @@ if [ -f .env ]; then export $(grep -v '^#' .env | xargs -d '\n') fi -# Use Git access token for accessing the docs repo if set +# Use Git access token for accessing the docs repo if set. +# In GitHub Actions when not in upstream rook/rook, default to fork's docs repo. # shellcheck disable=SC2034 -export DOCS_GIT_REPO="${DOCS_GIT_REPO:-git@github.com:rook/rook.github.io.git}" +if [ -z "${DOCS_GIT_REPO:-}" ]; then + if [ -n "${GITHUB_REPOSITORY:-}" ] && [ "${GITHUB_REPOSITORY}" != "rook/rook" ]; then + DOCS_GIT_REPO="git@github.com:${GITHUB_REPOSITORY_OWNER:-unknown}/rook.github.io.git" + else + DOCS_GIT_REPO="git@github.com:rook/rook.github.io.git" + fi +fi +export DOCS_GIT_REPO if [ -n "${GIT_API_TOKEN}" ]; then DOCS_GIT_REPO="${DOCS_GIT_REPO//git@/}" DOCS_GIT_REPO="${DOCS_GIT_REPO//:/\/}"