Skip to content

Increment patch version in Chart.yaml file #2

Increment patch version in Chart.yaml file

Increment patch version in Chart.yaml file #2

name: Release Charts
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install yq
run: sudo snap install yq
- name: Bump Patch Version
run: |
# Read the current version
version=$(yq e '.version' charts/libretranslate/Chart.yaml)
# Split the version into major, minor, and patch
IFS='.' read -ra VERSION_PARTS <<< "$version"
# Increment the minor version
VERSION_PARTS[2]=$((VERSION_PARTS[2] + 1))
# Reassemble the version string
new_version="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
# Update the version in the Chart.yaml file
yq e ".version = \"$new_version\"" -i charts/libretranslate/Chart.yaml
- name: Commit and Push
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add chart/Chart.yaml
git commit -m "Bump chart version"
git push
release:
needs: bump-version
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
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: Run chart-releaser
uses: helm/[email protected]
with:
skip_existing: true
mark_as_latest: true
packages_with_index: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"