Workflow: Release Helm chart (#626)
* Add Makefile target to release latest version of Helm chart * Add workflow that packages Helm chart release and creates PR with it * Remove old Helm targets
This commit is contained in:
		
							parent
							
								
									16b4723b79
								
							
						
					
					
						commit
						4e046280a3
					
				|  | @ -0,0 +1,40 @@ | ||||||
|  | name: Release Helm chart | ||||||
|  | 
 | ||||||
|  | # Run this workflow manually | ||||||
|  | on: | ||||||
|  |   workflow_dispatch: | ||||||
|  |     inputs: | ||||||
|  |       chartVersion: | ||||||
|  |         description: "Helm chart version to release. eg. 0.4.1" | ||||||
|  |         required: true | ||||||
|  |       appVersion: | ||||||
|  |         description: "Operator app version without quotes, eg. 0.5.1 . If not provided, the one in Chart.yaml won't be overwritten." | ||||||
|  |         required: false | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   release-helm-chart: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |       - name: Checkout code | ||||||
|  |         uses: actions/checkout@v2 | ||||||
|  | 
 | ||||||
|  |       - name: Deploy Helm chart | ||||||
|  |         run: | | ||||||
|  |           sed -i "/version:/c\version: ${{ github.event.inputs.chartVersion }}" chart/jenkins-operator/Chart.yaml | ||||||
|  | 
 | ||||||
|  |           if [ ${{ github.event.inputs.appVersion }} ] ; then | ||||||
|  |             sed -i "/appVersion:/c\appVersion: \"${{ github.event.inputs.appVersion }}\"" chart/jenkins-operator/Chart.yaml | ||||||
|  |           fi | ||||||
|  | 
 | ||||||
|  |           make helm-release-latest | ||||||
|  | 
 | ||||||
|  |       # Creates pull request with new chart version | ||||||
|  |       - name: Create Pull Request | ||||||
|  |         uses: peter-evans/create-pull-request@v3 | ||||||
|  |         with: | ||||||
|  |           commit-message: Release Helm chart ${{ github.event.inputs.chartVersion }} | ||||||
|  |           branch: helm-chart-release-${{ github.event.inputs.chartVersion }} | ||||||
|  |           title: Release ${{ github.event.inputs.chartVersion }} Helm Chart | ||||||
|  |           body: | | ||||||
|  |             Release ${{ github.event.inputs.chartVersion }} Helm Chart | ||||||
							
								
								
									
										14
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										14
									
								
								Makefile
								
								
								
								
							|  | @ -407,21 +407,15 @@ helm-lint: helm | ||||||
| 	@echo "+ $@" | 	@echo "+ $@" | ||||||
| 	bin/helm lint chart/jenkins-operator | 	bin/helm lint chart/jenkins-operator | ||||||
| 
 | 
 | ||||||
| .PHONY: helm-package | .PHONY: helm-release-latest | ||||||
| helm-package: helm | helm-release-latest: helm | ||||||
| 	@echo "+ $@" | 	@echo "+ $@" | ||||||
| 	mkdir -p /tmp/jenkins-operator-charts | 	mkdir -p /tmp/jenkins-operator-charts | ||||||
| 	mv chart/jenkins-operator/*.tgz /tmp/jenkins-operator-charts | 	mv chart/jenkins-operator/*.tgz /tmp/jenkins-operator-charts | ||||||
| 	cd chart && ../bin/helm package jenkins-operator | 	cd chart && ../bin/helm package jenkins-operator | ||||||
|  | 	mv chart/jenkins-operator-*.tgz chart/jenkins-operator/ | ||||||
|  | 	bin/helm repo index chart/ --url https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/ --merge chart/index.yaml | ||||||
| 	mv /tmp/jenkins-operator-charts/*.tgz chart/jenkins-operator/ | 	mv /tmp/jenkins-operator-charts/*.tgz chart/jenkins-operator/ | ||||||
| 	rm -rf /tmp/jenkins-operator-charts/ |  | ||||||
| 	git add chart/jenkins-operator-*.tgz |  | ||||||
| 
 |  | ||||||
| .PHONY: helm-deploy |  | ||||||
| helm-deploy: helm-package |  | ||||||
| 	@echo "+ $@" |  | ||||||
| 	bin/helm repo index chart/ --url https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/ |  | ||||||
| 	cd chart/ && mv jenkins-operator-*.tgz jenkins-operator |  | ||||||
| 
 | 
 | ||||||
| # Download and build hugo extended locally if necessary
 | # Download and build hugo extended locally if necessary
 | ||||||
| HUGO_PATH = $(shell pwd)/bin/hugo | HUGO_PATH = $(shell pwd)/bin/hugo | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue