Merge pull request #3273 from Poor12/push-charts-to-dockerhub
Push charts to dockerHub
This commit is contained in:
		
						commit
						91646da681
					
				|  | @ -0,0 +1,34 @@ | ||||||
|  | name: latest chart to DockerHub | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - master | ||||||
|  | jobs: | ||||||
|  |   publish-chart-to-dockerhub: | ||||||
|  |     name: publish to DockerHub | ||||||
|  |     # prevent job running from forked repository, otherwise | ||||||
|  |     # 1. running on the forked repository would fail as missing necessary secret. | ||||||
|  |     # 2. running on the forked repository would use unnecessary GitHub Action time. | ||||||
|  |     if: ${{ github.repository == 'karmada-io/karmada' && github.ref == 'refs/heads/master' }} | ||||||
|  |     runs-on: ubuntu-20.04 | ||||||
|  |     steps: | ||||||
|  |       - name: checkout code | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           # fetch-depth: | ||||||
|  |           # 0 indicates all history for all branches and tags. | ||||||
|  |           # for `git describe --tags` in Makefile. | ||||||
|  |           fetch-depth: 0 | ||||||
|  |       - name: login to DockerHub | ||||||
|  |         uses: docker/login-action@v2 | ||||||
|  |         with: | ||||||
|  |           username: ${{ secrets.DOCKERHUB_USER_NAME }} | ||||||
|  |           password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||
|  |       - name: package chart | ||||||
|  |         env: | ||||||
|  |           VERSION: 0.0.0 | ||||||
|  |         run: make package-chart | ||||||
|  |       - name: push chart | ||||||
|  |         env: | ||||||
|  |           VERSION: 0.0.0 | ||||||
|  |         run: make push-chart | ||||||
|  | @ -0,0 +1,30 @@ | ||||||
|  | name: released chart to DockerHub | ||||||
|  | on: | ||||||
|  |   release: | ||||||
|  |     types: | ||||||
|  |       - published | ||||||
|  | jobs: | ||||||
|  |   publish-chart-to-dockerhub: | ||||||
|  |     name: publish to DockerHub | ||||||
|  |     runs-on: ubuntu-20.04 | ||||||
|  |     steps: | ||||||
|  |       - name: checkout code | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           # fetch-depth: | ||||||
|  |           # 0 indicates all history for all branches and tags. | ||||||
|  |           # for `git describe --tags` in Makefile. | ||||||
|  |           fetch-depth: 0 | ||||||
|  |       - name: login to DockerHub | ||||||
|  |         uses: docker/login-action@v2 | ||||||
|  |         with: | ||||||
|  |           username: ${{ secrets.DOCKERHUB_USER_NAME }} | ||||||
|  |           password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||
|  |       - name: package chart | ||||||
|  |         env: | ||||||
|  |           VERSION: ${{ github.ref_name }} | ||||||
|  |         run: make package-chart | ||||||
|  |       - name: push chart | ||||||
|  |         env: | ||||||
|  |           VERSION: ${{ github.ref_name }} | ||||||
|  |         run: make push-chart | ||||||
|  | @ -30,7 +30,9 @@ jobs: | ||||||
|         GOARCH: ${{ matrix.arch }} |         GOARCH: ${{ matrix.arch }} | ||||||
|       run: make release-${{ matrix.target }} |       run: make release-${{ matrix.target }} | ||||||
|     - name: Making helm charts |     - name: Making helm charts | ||||||
|       run: make release-chart |       env: | ||||||
|  |         VERSION: ${{ github.ref_name }} | ||||||
|  |       run: make package-chart | ||||||
|     - name: Uploading assets... |     - name: Uploading assets... | ||||||
|       if: ${{ !env.ACT }} |       if: ${{ !env.ACT }} | ||||||
|       uses: softprops/action-gh-release@v1 |       uses: softprops/action-gh-release@v1 | ||||||
|  | @ -38,8 +40,8 @@ jobs: | ||||||
|         files: | |         files: | | ||||||
|           _output/release/${{ matrix.target }}-${{ matrix.os }}-${{ matrix.arch }}.tgz |           _output/release/${{ matrix.target }}-${{ matrix.os }}-${{ matrix.arch }}.tgz | ||||||
|           _output/release/${{ matrix.target }}-${{ matrix.os }}-${{ matrix.arch }}.tgz.sha256 |           _output/release/${{ matrix.target }}-${{ matrix.os }}-${{ matrix.arch }}.tgz.sha256 | ||||||
|           _output/release/karmada-chart-*.tgz |           _output/charts/karmada-chart-${{ github.ref_name }}.tgz | ||||||
|           _output/release/karmada-chart-*.tgz.sha256 |           _output/charts/karmada-chart-${{ github.ref_name }}.tgz.sha256 | ||||||
|   update-krew-index: |   update-krew-index: | ||||||
|     needs: release-assests |     needs: release-assests | ||||||
|     name: Update krew-index |     name: Update krew-index | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										10
									
								
								Makefile
								
								
								
								
							|  | @ -92,9 +92,13 @@ update: | ||||||
| verify: | verify: | ||||||
| 	hack/verify-all.sh | 	hack/verify-all.sh | ||||||
| 
 | 
 | ||||||
| .PHONY: release-chart | .PHONY: package-chart | ||||||
| release-chart: | package-chart: | ||||||
| 	hack/release-helm-chart.sh $(VERSION) | 	hack/package-helm-chart.sh $(VERSION) | ||||||
|  | 
 | ||||||
|  | .PHONY: push-chart | ||||||
|  | push-chart: | ||||||
|  | 	helm push _output/charts/karmada-chart-${VERSION}.tgz oci://docker.io/karmada | ||||||
| 
 | 
 | ||||||
| .PHONY: test | .PHONY: test | ||||||
| test: | test: | ||||||
|  |  | ||||||
|  | @ -20,12 +20,13 @@ kubeVersion: ">= 1.16.0-0" | ||||||
| # This is the chart version. This version number should be incremented each time you make changes | # This is the chart version. This version number should be incremented each time you make changes | ||||||
| # to the chart and its templates, including the app version. | # to the chart and its templates, including the app version. | ||||||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||||||
| version: 0.0.5 | # We use `0.0.0` as the latest chart version. | ||||||
|  | version: 0.0.0 | ||||||
| 
 | 
 | ||||||
| # This is the version number of the application being deployed. This version number should be | # This is the version number of the application being deployed. This version number should be | ||||||
| # incremented each time you make changes to the application. Versions are not expected to | # incremented each time you make changes to the application. Versions are not expected to | ||||||
| # follow Semantic Versioning. They should reflect the version the application is using. | # follow Semantic Versioning. They should reflect the version the application is using. | ||||||
| appVersion: v1.1.0 | appVersion: latest | ||||||
| 
 | 
 | ||||||
| # This is karmada dependencies | # This is karmada dependencies | ||||||
| dependencies: | dependencies: | ||||||
|  |  | ||||||
|  | @ -6,12 +6,11 @@ set -o pipefail | ||||||
| REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||||||
| source "${REPO_ROOT}"/hack/util.sh | source "${REPO_ROOT}"/hack/util.sh | ||||||
| 
 | 
 | ||||||
| # keep v1.x.x forms | version=${1} | ||||||
| version=${1%%-*} | output_dir="${REPO_ROOT}/_output/charts" | ||||||
| 
 | 
 | ||||||
| release_dir="${REPO_ROOT}/_output/release" |  | ||||||
| tar_file="karmada-chart-${version}.tgz" | tar_file="karmada-chart-${version}.tgz" | ||||||
| mkdir -p "${release_dir}" | mkdir -p "${output_dir}" | ||||||
| 
 | 
 | ||||||
| # install helm | # install helm | ||||||
| echo -n "Preparing: 'helm' existence check - " | echo -n "Preparing: 'helm' existence check - " | ||||||
|  | @ -23,8 +22,8 @@ else | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| echo "Starting to package into a Karmada chart archive" | echo "Starting to package into a Karmada chart archive" | ||||||
| helm package ./charts/karmada --version "${version}" -d "${release_dir}" -u | helm package ./charts/karmada --version "${version}" -d "${output_dir}" -u | ||||||
| cd "${release_dir}" | cd "${output_dir}" | ||||||
| mv "karmada-${version}.tgz" ${tar_file} | mv "karmada-${version}.tgz" ${tar_file} | ||||||
| echo "Rename karmada-${version}.tgz to ${tar_file}" | echo "Rename karmada-${version}.tgz to ${tar_file}" | ||||||
| sha256sum "${tar_file}" > "${tar_file}.sha256" | sha256sum "${tar_file}" > "${tar_file}.sha256" | ||||||
		Loading…
	
		Reference in New Issue