Skip to content

Commit

Permalink
Create draft release automation (#261)
Browse files Browse the repository at this point in the history
* Create draft release automation

* cleanup ClusterResourceSet config

* use right img for build-infra-yaml

* pass IMG from workflow

* add step to setup go
  • Loading branch information
shamsher31 authored Nov 25, 2021
1 parent 4a7252e commit 85f1600
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Draft Release

on:
push:
# Build and publish artifacts when new tag is created for release
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Build Release Artifacts
run: IMG="projects.registry.vmware.com/cluster_api_provider_bringyourownhost/cluster-api-byoh-controller:${{ env.GITHUB_REF }}" make build-release-artifacts

- name: Publish Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
files: |
_dist/byoh-hostagent-linux-amd64
_dist/cluster-template.yaml
_dist/infrastructure-components.yaml
_dist/metadata.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ bin
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Distribution related files
_dist

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*
Expand Down
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api

IMAGE_NAME ?= cluster-api-byoh-controller
TAG ?= dev
RELEASE_DIR := _dist

# Image URL to use all building/pushing image targets
IMG ?= ${STAGING_REGISTRY}/${IMAGE_NAME}:${TAG}
Expand Down Expand Up @@ -168,6 +169,29 @@ host-agent-binary: $(RELEASE_DIR)
-o ./bin/$(notdir $(RELEASE_BINARY))-$(GOOS)-$(GOARCH) $(HOST_AGENT_DIR)


##@Release

$(RELEASE_DIR):
rm -rf $(RELEASE_DIR)
mkdir -p $(RELEASE_DIR)

build-release-artifacts: build-cluster-templates build-infra-yaml build-metadata-yaml build-host-agent-binary

build-cluster-templates: $(RELEASE_DIR) cluster-templates
cp $(BYOH_TEMPLATES)/v1beta1/cluster-template.yaml $(RELEASE_DIR)/cluster-template.yaml
sed -i -e 1,20d $(RELEASE_DIR)/cluster-template.yaml

build-infra-yaml:kustomize # Generate infrastructure-components.yaml for the provider
cd config/manager && $(KUSTOMIZE) edit set image gcr.io/k8s-staging-cluster-api/cluster-api-byoh-controller=${IMG}
$(KUSTOMIZE) build config/default > $(RELEASE_DIR)/infrastructure-components.yaml

build-metadata-yaml:
cp metadata.yaml $(RELEASE_DIR)/metadata.yaml

build-host-agent-binary: host-agent-binaries
cp bin/byoh-hostagent-linux-amd64 $(RELEASE_DIR)/byoh-hostagent-linux-amd64


# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
Expand Down

0 comments on commit 85f1600

Please sign in to comment.