Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: GHA workflow to release image to ghcr.io #2

Merged
merged 1 commit into from
Apr 16, 2024
Merged
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
26 changes: 26 additions & 0 deletions .github/workflows/release-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release to ghcr.io
on:
push:
tags:
- "*-d2iq.*"

# Because variables are not exported, they are not visible by child processes, e.g. make
env:
registry: ghcr.io/mesosphere

jobs:
release-image:
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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -499,7 +500,7 @@ e2e: $(GINKGO) $(KUSTOMIZE) $(KIND) $(GOVC) ## Run e2e tests
##@ release:

## latest git tag for the commit, e.g., v0.3.10
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
RELEASE_TAG ?= $(shell git describe --tags --always 2>/dev/null)
ifneq (,$(findstring -,$(RELEASE_TAG)))
PRE_RELEASE=true
endif
Expand Down Expand Up @@ -607,6 +608,11 @@ generate-flavors: $(FLAVOR_DIR)
release-staging: ## Build and push container images to the staging registry
REGISTRY=$(STAGING_REGISTRY) $(MAKE) docker-build-all docker-push-all release-alias-tag

.PHONY: release-ghcr
release-ghcr: ## Build and push container images to the ghcr.io
REGISTRY=$(GHCR_REGISTRY) TAG=$(RELEASE_TAG) $(MAKE) docker-build-all docker-push-all


.PHONY: release-alias-tag
release-alias-tag: ## Add the release alias tag to the last build tag
gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
Expand Down
Loading