Skip to content

Commit

Permalink
Automate Github Release Draft with Github Action
Browse files Browse the repository at this point in the history
Automatically create Github release when we create git tag, and it creates the draft with a nice structure and with the bundle dir (for community releases). We also create new targets for community usage
  • Loading branch information
razo7 committed Apr 27, 2023
1 parent 153b941 commit 52c8864
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/post-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,35 @@ jobs:

- name: Build and push CSV 0.0.1 + latest images for PR merges to main
if: ${{ github.ref_type != 'tag' }}
run: export IMAGE_REGISTRY=quay.io/medik8s && make container-build-and-push
run: export IMAGE_REGISTRY=quay.io/medik8s && make container-build-and-push-community

- name: Build and push versioned CSV and images for tags
if: ${{ github.ref_type == 'tag' }}
# remove leading 'v' from tag!
run: export IMAGE_REGISTRY=quay.io/medik8s && export VERSION=$(echo $GITHUB_REF_NAME | sed 's/v//') && make container-build-and-push
run: export VERSION=$(echo $GITHUB_REF_NAME | sed 's/v//') && make container-build-and-push-community

- name: Create release with manifests
if: ${{ github.ref_type == 'tag' }}
# https://github.com/marketplace/actions/github-release-create-update-and-upload-assets
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
body: |
# Node Maintenance Operator ${{ github.ref_name }}
## Notable Changes
* TODO
## Release Artifacts
### Images
* Operator: quay.io/repository/medik8s/node-maintenance-operator:${{ github.ref_name }}
* Bundle: quay.io/repository/medik8s/node-maintenance-operator-bundle:${{ github.ref_name }}
* Catalog aka Index: quay.io/repository/medik8s/node-maintenance-operator-catalog:${{ github.ref_name }}
### Source code and OLM manifests
Please find the source code and the OLM manifests in the `Assets` section below.
gzip: folders
files: >
Manifests:bundle/
2 changes: 1 addition & 1 deletion .github/workflows/pre-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs: # jobs to run
run: make check

- name: Build images
run: make container-build
run: make container-build-community
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,20 @@ container-build: check ## Build containers
$(DOCKER_GO) "make bundle"
make docker-build bundle-build must-gather-build

.PHONY: bundle-build-community
bundle-build-community: bundle-community ## Run bundle community changes in CSV, and then build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: container-build-community
container-build-community: check ## Build containers for community
$(DOCKER_GO) "make bundle-community"
make docker-build bundle-build-community must-gather-build

.PHONY: container-push
container-push: docker-push bundle-push catalog-build catalog-push must-gather-push ## Push containers (NOTE: catalog can't be build before bundle was pushed)

.PHONY: container-build-and-push
container-build-and-push: container-build container-push ## Build and push all the four images to quay (docker, bundle, catalog, and must-gather).

.PHONY: container-build-and-push-community
container-build-and-push-community: container-build-community container-push ## Build four images, update CSV for community, and push all the images to Quay (docker, bundle, catalog, and must-gather).
.PHONY: cluster-functest
cluster-functest: ginkgo ## Run e2e tests in a real cluster
./hack/functest.sh $(GINKGO_VERSION)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ For every major / minor / patch release:

- create and push the `vx.y.z` tag.
- this should trigger CI to build and push new images
- if it fails, the manual fallback is `VERSION=x.y.z make container-build container-push`
- if it fails, the manual fallback is `VERSION=x.y.z make container-build-and-push-community`
- make the git tag a release in the GitHub UI.

## Help
Expand Down

0 comments on commit 52c8864

Please sign in to comment.