diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 30b8f52c23..c03e22af38 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,9 @@ on: branches: - master +env: + HELM_VERSION: 3.8.2 + jobs: backend: name: Backend @@ -50,3 +53,19 @@ jobs: ${{ runner.os }}-yarn- - name: Build web static run: make build-frontend + + chart: + name: Helm Chart + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install helm + uses: Azure/setup-helm@v1 + with: + version: ${{ env.HELM_VERSION }} + - name: Package pipecd chart + run: make package-chart CHART=pipecd + - name: Package piped chart + run: make package-chart CHART=piped diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0e756bb773..b4835d955c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -7,6 +7,7 @@ on: env: REGISTRY: ghcr.io + HELM_VERSION: 3.8.2 jobs: image: @@ -49,7 +50,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Start building and pushing container images. + # Building and pushing container images. - name: Build and push pipecd image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: @@ -92,3 +93,20 @@ jobs: context: . file: cmd/helloworld/Dockerfile tags: ${{ env.REGISTRY }}/pipe-cd/helloworld:${{ env.PIPECD_VERSION }} + + # Building and pushing Helm charts. + - name: Install helm + uses: Azure/setup-helm@v1 + with: + version: ${{ env.HELM_VERSION }} + - name: Login to OCI using Helm + run: | + echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.REGISTRY }} --username ${{ github.repository_owner }} --password-stdin + - name: Publish pipecd chart + run: | + make package-chart CHART=pipecd + helm push .artifacts/pipecd-${{ env.PIPECD_VERSION }}.tgz oci://${{ env.REGISTRY }}/pipe-cd/chart + - name: Publish piped chart + run: | + make package-chart CHART=piped + helm push .artifacts/piped-${{ env.PIPECD_VERSION }}.tgz oci://${{ env.REGISTRY }}/pipe-cd/chart diff --git a/Makefile b/Makefile index 930a71b653..8d984ac1f6 100644 --- a/Makefile +++ b/Makefile @@ -150,3 +150,10 @@ GO_BUILD_ENV ?= GOOS=linux GOARCH=amd64 .PHONY: build-go build-go: $(GO_BUILD_ENV) CGO_ENABLED=0 go build $(GO_BUILD_OPTS) -o ./.artifacts/$(GO_BUILD_COMPONENT) ./cmd/$(GO_BUILD_COMPONENT) + +.PHONY: package-chart +package-chart: CHART ?= pipecd +package-chart: VERSION ?= $(shell git describe --tags --always --dirty --abbrev=7) +package-chart: + mkdir -p .artifacts + helm package manifests/$(CHART) --version $(VERSION) --app-version $(VERSION) --dependency-update --destination .artifacts diff --git a/manifests/pipecd/Chart.yaml b/manifests/pipecd/Chart.yaml index 50a0c835c1..3fc38afc84 100644 --- a/manifests/pipecd/Chart.yaml +++ b/manifests/pipecd/Chart.yaml @@ -10,12 +10,12 @@ type: application # 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. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: {{ .VERSION }} +version: 0.0.0 # 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 # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: {{ .VERSION }} +appVersion: 0.0.0 # If you want to update the version of any child charts, bump the version to an arbitrary one. dependencies: diff --git a/manifests/piped/Chart.yaml b/manifests/piped/Chart.yaml index 9d23d23b10..4eb33dff93 100644 --- a/manifests/piped/Chart.yaml +++ b/manifests/piped/Chart.yaml @@ -10,9 +10,9 @@ type: application # 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. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: {{ .VERSION }} +version: 0.0.0 # 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 # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: {{ .VERSION }} +appVersion: 0.0.0