Skip to content

Commit 7092eda

Browse files
committed
ci(helm): Create github release on tag for helm charts
1 parent 2e83f91 commit 7092eda

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

.github/workflows/kubernetes-charts-build.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.repository == 'CogStack/cogstack-platform-toolkit'
2121
steps:
22-
- name: Checkout
22+
- name: CheckoutO
2323
uses: actions/checkout@v3
2424
with:
2525
fetch-depth: 0
@@ -42,7 +42,7 @@ jobs:
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)
@@ -60,8 +60,10 @@ jobs:
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,6 +79,17 @@ 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: |
8295
helm package ./charts/medcat-service-helm --version $CHART_VERSION
@@ -89,3 +102,12 @@ jobs:
89102
run: |
90103
helm push ./medcat-service-helm-${CHART_VERSION}.tgz oci://registry-1.docker.io/cogstacksystems
91104
helm push ./medcat-trainer-helm-${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-${CHART_VERSION}.tgz
113+
./deployment/kubernetes/medcat-trainer-helm-${CHART_VERSION}.tgz

0 commit comments

Comments
 (0)