Skip to content

Commit

Permalink
fix: now release automatically does helm push and update its tag
Browse files Browse the repository at this point in the history
  • Loading branch information
byhlel committed Sep 26, 2024
1 parent 477f674 commit d2dfea8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
run : |
make ./hack/copyright-check.sh

- name: Build Kmesh
shell: bash
run: |
Expand Down Expand Up @@ -67,3 +69,38 @@ jobs:
flags: unittests
fail_ci_if_error: false
verbose: true
helm:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: '3.12.3'
token: ${{ secrets.GH_PAT }}

- name: Check for Changes
id: check_changes
run: |
git diff --exit-code deploy/charts/kmesh-helm/Chart.yaml || echo "changed" >> $GITHUB_ENV
- name: Bump Version
if: env.changed == 'changed'
run: |
# With this we read the current version
current_version=$(grep 'version:' deploy/charts/kmesh-helm/Chart.yaml | awk '{print $2}')
IFS='.' read -r major minor patch <<< "$current_version"
# Now we increment the patch version
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch"
# And don't forget to update Chart.yaml with the new version
sed -i "s/version: .*/version: $new_version/" deploy/charts/kmesh-helm/Chart.yaml
- name: Update Image Tag
if: env.changed == 'changed'
run: |
sed -i "s/image: .*/image: my-image:new_version/" deploy/kubernetes/deployment.yaml
14 changes: 13 additions & 1 deletion .github/workflows/release-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ jobs:
with:
version: '3.12.3'
token: ${{ secrets.GH_PAT }}


- name: Set Version
id: set_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Update Chart.yaml
run: |
sed -i "s/version: .*/version: $VERSION/" deploy/charts/kmesh-helm/Chart.yaml
- name: Update Image Tag
run: |
sed -i "s/image: .*/image: my-image:$VERSION/" deploy/kubernetes/deployment.yaml
- name: Build and Push the Helm Charts to GitHub Container Registry
uses: JimCronqvist/action-helm-chart-repo@master
chart-path: deploy/charts/kmesh-helm
Expand Down

0 comments on commit d2dfea8

Please sign in to comment.