From ef294995683925fb56c895bad0dc623934dfd8bd Mon Sep 17 00:00:00 2001 From: Shalin Patel Date: Tue, 16 Apr 2024 13:28:13 -0700 Subject: [PATCH] ci: GHA workflow to release image to ghcr.io --- .github/workflows/release-image.yaml | 26 ++++++++++++++++++++++++++ Makefile | 8 +++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-image.yaml diff --git a/.github/workflows/release-image.yaml b/.github/workflows/release-image.yaml new file mode 100644 index 0000000000..482210bd00 --- /dev/null +++ b/.github/workflows/release-image.yaml @@ -0,0 +1,26 @@ +name: Release +on: + push: + tags: + - "*-d2iq.test.dev*" + +# Because variables are not exported, they are not visible by child processes, e.g. make +env: + registry: ghcr.io/mesosphere + +jobs: + release: + name: Release + runs-on: + - ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Login to container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.registry }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push container image + run: | + make release-ghcr \ No newline at end of file diff --git a/Makefile b/Makefile index 82946d63c8..863283f194 100644 --- a/Makefile +++ b/Makefile @@ -188,6 +188,7 @@ REGISTRY ?= gcr.io/$(shell gcloud config get-value project) PROD_REGISTRY ?= registry.k8s.io/cluster-api-vsphere STAGING_REGISTRY ?= gcr.io/k8s-staging-capi-vsphere +GHCR_REGISTRY ?= ghcr.io/mesosphere/cluster-api-provider-vsphere STAGING_BUCKET ?= artifacts.k8s-staging-capi-vsphere.appspot.com # core @@ -605,7 +606,12 @@ generate-flavors: $(FLAVOR_DIR) .PHONY: release-staging release-staging: ## Build and push container images to the staging registry - REGISTRY=$(STAGING_REGISTRY) $(MAKE) docker-build-all docker-push-all release-alias-tag + REGISTRY=$(STAGING_REGISTRY) TAG=$(RELEASE_TAG) $(MAKE) docker-build-all docker-push-all release-alias-tag + +.PHONY: release-ghcr +release-ghcr: ## Build and push container images to the staging registry + REGISTRY=$(GHCR_REGISTRY) $(MAKE) docker-build-all docker-push-all + .PHONY: release-alias-tag release-alias-tag: ## Add the release alias tag to the last build tag