Skip to content

Merge pull request #214 from harness/main #26

Merge pull request #214 from harness/main

Merge pull request #214 from harness/main #26

Workflow file for this run

name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for specified branches
push:
branches: [ "develop" ]
# pull_request:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.9.2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
# Chart testing command docs https://github.com/helm/chart-testing#usage
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.8.0
# - name: Run chart-testing (list-changed)
# working-directory: ./src
# id: list-changed
# run: |
# changed=$(ct list-changed --target-branch=develop)
# if [[ -n "$changed" ]]; then
# echo "::set-output name=changed::true"
# fi
- name: Run chart-testing (lint)
working-directory: ./src/common
run: ct lint --target-branch=develop --charts=. --chart-repos=harness-common=https://harness.github.io/helm-common/charts,common=https://charts.bitnami.com/bitnami --validate-maintainers=false
# - name: Create kind cluster/search
# uses: helm/kind-action@v1.2.0
# if: steps.list-changed.outputs.changed == 'true'
# - name: Run chart-testing (install)
# working-directory: ./src
# run: ct install --target-branch=develop --charts=. --chart-repos=harness-common=https://harness.github.io/helm-common/charts,common=https://charts.bitnami.com/bitnami
- name: Generate develop version and update Chart.yaml
working-directory: ./src/common
run: |
BASE_VERSION=$(grep '^version:' Chart.yaml | awk '{print $2}')
DEV_VERSION="${BASE_VERSION}-develop.${{ github.run_number }}"
echo "Generated version: ${DEV_VERSION}"
sed -i "s/^version: .*/version: ${DEV_VERSION}/" Chart.yaml
- name: Add Helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Package chart
working-directory: ./src
run: |
helm dependency update common
helm package common
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Publish to chart repository
run: |
cp src/*.tgz gh-pages/
helm repo index gh-pages --url https://harness.github.io/helm-common --merge gh-pages/index.yaml
cd gh-pages
git config user.name "$GITHUB_ACTION"
git config user.email "$GITHUB_ACTION@users.noreply.github.com"
git add *.tgz index.yaml
git commit -m "Add develop chart build ${{ github.run_number }}"
git push