Skip to content

Commit

Permalink
Start publishing helm charts on GHCR (#3562)
Browse files Browse the repository at this point in the history
* Start publishing helm charts on GHCR

* Fix script
  • Loading branch information
nghialv authored Apr 21, 2022
1 parent 8edeccd commit e4066d4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- master

env:
HELM_VERSION: 3.8.2

jobs:
backend:
name: Backend
Expand Down Expand Up @@ -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
20 changes: 19 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
REGISTRY: ghcr.io
HELM_VERSION: 3.8.2

jobs:
image:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions manifests/pipecd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions manifests/piped/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e4066d4

Please sign in to comment.