44 push :
55 branches : [ main ]
66 tags :
7- - ' v*.*.*' # e.g., v0.1.1
7+ - ' helm-charts- v*.*.*' # e.g., helm-charts- v0.1.1
88 pull_request :
99 paths :
10- - ' deployment/kubernetes/**'
10+ - ' deployment/kubernetes/charts/ **'
1111 - ' .github/workflows/kubernetes**'
1212
1313defaults :
4242 run : |
4343 changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch}})
4444 if [[ -n "$changed" ]]; then
45- echo "changed=true" >> "$GITHUB_OUTPUT "
45+ echo "changed=true" >> "$GITHUB_UTPUT "
4646 fi
4747
4848 - name : Run chart-testing (lint)
6060 helm-publish :
6161 runs-on : ubuntu-latest
6262 needs : helm-lint-test
63+ permissions :
64+ contents : write
6365 env :
64- CHART_VERSION : 0.0.1
66+ DEFAULT_CHART_VERSION : 0.0.1
6567 steps :
6668 - name : Log in to Docker Hub
6769 uses : docker/login-action@v1
@@ -77,15 +79,35 @@ jobs:
7779 - name : Checkout
7880 uses : actions/checkout@v5
7981
82+ - name : Determine version
83+ id : version
84+ run : |
85+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
86+ # Strip the tag prefix chart-
87+ CHART_VERSION="${GITHUB_REF_NAME#helm-charts-}"
88+ else
89+ CHART_VERSION="$DEFAULT_CHART_VERSION"
90+ fi
91+ echo "chart_version=$CHART_VERSION" >> "$GITHUB_OUTPUT"
92+
8093 - name : Package Helm Charts
8194 run : |
82- helm package ./charts/medcat-service-helm --version $CHART_VERSION
83- helm package ./charts/medcat-trainer-helm --version $CHART_VERSION --dependency-update
95+ helm package ./charts/medcat-service-helm --version ${{ steps.version.outputs.chart_version }}
96+ helm package ./charts/medcat-trainer-helm --version ${{ steps.version.outputs.chart_version }} --dependency-update
8497
8598 - name : Helm OCI login to Docker Hub
8699 run : helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
87100
88101 - name : Push Helm Chart to Docker Hub OCI
89102 run : |
90- helm push ./medcat-service-helm-${CHART_VERSION}.tgz oci://registry-1.docker.io/cogstacksystems
91- helm push ./medcat-trainer-helm-${CHART_VERSION}.tgz oci://registry-1.docker.io/cogstacksystems
103+ helm push ./medcat-service-helm-${{ steps.version.outputs.chart_version }}.tgz oci://registry-1.docker.io/cogstacksystems
104+ helm push ./medcat-trainer-helm-${{ steps.version.outputs.chart_version }}.tgz oci://registry-1.docker.io/cogstacksystems
105+
106+ - name : Release
107+ uses : softprops/action-gh-release@v2
108+ if : github.ref_type == 'tag'
109+ with :
110+ draft : true
111+ files : |
112+ ./deployment/kubernetes/medcat-service-helm-${{ steps.version.outputs.chart_version }}.tgz
113+ ./deployment/kubernetes/medcat-trainer-helm-${{ steps.version.outputs.chart_version }}.tgz
0 commit comments