Skip to content

Commit

Permalink
Test & release with GitHub actions (#26)
Browse files Browse the repository at this point in the history
* feat: GitHub actions, closes #25
  • Loading branch information
DrPsychick authored Mar 16, 2023
1 parent b4810d6 commit 6c03508
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 50 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions .github/cr-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pages-index-path: docs/index.yaml
generate-release-notes: true
skip-existing: true
47 changes: 47 additions & 0 deletions .github/workflows/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test Charts
on:
push:
branches:
- master

pull_request:
types: [ opened, reopened, synchronize ]
paths:
- "sickhub/**"
- ".github/workflows/**"

jobs:
test:
name: Test Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@v3

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs sickhub --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
ct lint --chart-dirs sickhub --all
- name: Create kind cluster
uses: helm/[email protected]
if: github.ref == 'refs/heads/master' || steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
id: chart-install
run: ct install --chart-dirs sickhub --remote origin --all
if: github.ref == 'refs/heads/master' || steps.list-changed.outputs.changed == 'true'
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Charts
on:
workflow_run:
workflows:
- "Test Charts"
branches:
- master
types:
- completed

jobs:
release:
name: Publish Helm Chart
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Configure Helm repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/[email protected]
with:
config: .github/cr-config.yaml
charts_dir: sickhub
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/sickhub)](https://artifacthub.io/packages/search?org=sickhub)
[![CircleCI](https://img.shields.io/circleci/build/github/SickHub/charts)](https://app.circleci.com/pipelines/github/SickHub/charts)
[![Workflow Status](https://img.shields.io/github/actions/workflow/status/sickhub/charts/release.yaml)](https://github.com/SickHub/charts/actions)
[![license](https://img.shields.io/github/license/sickhub/charts.svg)](https://github.com/sickhub/charts/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/sickhub/charts.svg)](https://github.com/sickhub/charts)
[![Contributors](https://img.shields.io/github/contributors/sickhub/charts.svg)](https://github.com/sickhub/charts/graphs/contributors)
Expand All @@ -26,10 +26,5 @@ On Artifact Hub: https://artifacthub.io/packages/search?org=sickhub
* See [Contributing](CONTRIBUTING.md)

### Publish new chart version
```shell
# (usual process) change chart version in master commit, then publish:
./publish-chart.sh UPDATE

# force bump the version of all charts:
./publish-chart.sh
```
Create a PR that includes a version change in `Chart.yaml` of the Helm Chart. The action `chart-releaser` will detect
it, package it and create a new release in GitHub as well as update the `gh-pages` repository `index.yaml`.
40 changes: 0 additions & 40 deletions publish-chart.sh

This file was deleted.

2 changes: 1 addition & 1 deletion sickhub/cronjobs/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: cronjobs
description: A generic helm cronjob chart for kubernetes
type: application
version: 0.1.5
version: 0.1.6
appVersion: latest
home: https://github.com/SickHub
icon: https://raw.githubusercontent.com/SickHub/charts/master/sickhub/cronjobs/icon.png
Expand Down
2 changes: 1 addition & 1 deletion sickhub/nginx-phpfpm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: nginx-phpfpm
description: A chart for an nginx pod with multiple phpfpm pods
type: application
version: 0.0.9
version: 0.0.10
appVersion: "8-fpm-alpine"
home: https://github.com/SickHub
icon: https://raw.githubusercontent.com/SickHub/charts/master/sickhub/nginx-phpfpm/icon.png
Expand Down

0 comments on commit 6c03508

Please sign in to comment.