2024-11-11 14:06:38 +00:00
|
|
|
name: Package and publish helm chart
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
package-helm:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
name: Check out code
|
|
|
|
|
|
|
|
- name: Set up Helm
|
|
|
|
uses: azure/setup-helm@v4.2.0
|
|
|
|
with:
|
|
|
|
version: v3.14.4
|
|
|
|
|
|
|
|
- name: Set up yq
|
|
|
|
uses: mikefarah/yq@master
|
|
|
|
|
|
|
|
- name: Check for changed charts
|
|
|
|
id: changed-files
|
|
|
|
uses: tj-actions/changed-files@v44
|
|
|
|
with:
|
|
|
|
dir_names: true
|
|
|
|
dir_names_max_depth: '2'
|
|
|
|
files: 'charts/**'
|
|
|
|
|
|
|
|
- name: build helm package
|
|
|
|
shell: bash
|
|
|
|
env:
|
2024-11-11 14:44:54 +00:00
|
|
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
2024-11-11 14:06:38 +00:00
|
|
|
CHART_NAME: ${{ steps.chart_name.outputs.result }}
|
|
|
|
CHART_VERSION: ${{ steps.chart_version.outputs.result }}
|
|
|
|
ALL_CHANGED_CHARTS: ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
run: |
|
|
|
|
REPO_PATH=$(git rev-parse --show-toplevel)
|
|
|
|
for chart in ${ALL_CHANGED_CHARTS}; do
|
2024-11-11 14:17:52 +00:00
|
|
|
cd ${REPO_PATH}/${chart}
|
2024-11-11 14:06:38 +00:00
|
|
|
CHART_NAME=$(yq .name Chart.yaml)
|
|
|
|
CHART_VERSION=$(yq .version Chart.yaml)
|
2024-11-11 14:24:23 +00:00
|
|
|
echo "Building dependancies for helm-chart"
|
|
|
|
helm dependency build
|
2024-11-11 14:14:18 +00:00
|
|
|
echo "Packaging ${CHART_NAME}-${CHART_VERSION}"
|
2024-11-11 14:20:21 +00:00
|
|
|
helm package .
|
2024-11-11 14:35:50 +00:00
|
|
|
echo "$(ls -l)"
|
2024-11-11 14:44:54 +00:00
|
|
|
echo "curl -H \"Authorization: token $PACKAGE_TOKEN\" -X POST --upload-file ${CHART_NAME}-${CHART_VERSION}.tgz https://git.rre.nu/api/packages/jonas/helm/api/charts"
|
2024-11-11 14:06:38 +00:00
|
|
|
done
|