72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
name: Bump Helm Chart Version
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
jellyfin_version:
|
|
description: 'Application version to set in Chart.yaml'
|
|
required: true
|
|
default: '1.0.0'
|
|
|
|
jobs:
|
|
bump-version:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Bump chart version and set appVersion
|
|
id: bump_version
|
|
run: |
|
|
# Read the current version from the Chart.yaml
|
|
current_version=$(grep '^version:' Chart.yaml | awk '{print $2}')
|
|
echo "Current version: $current_version"
|
|
|
|
# Split the version by dot and increment the minor version
|
|
major=$(echo "$current_version" | cut -d '.' -f 1)
|
|
minor=$(echo "$current_version" | cut -d '.' -f 2)
|
|
patch=$(echo "$current_version" | cut -d '.' -f 3)
|
|
new_version="$major.$((minor+1)).0"
|
|
|
|
echo "New chart version: $new_version"
|
|
|
|
# Get the app version passed as an input
|
|
jellyfin_version="${{ github.event.inputs.jellyfin_version }}"
|
|
echo "Setting appVersion to: $jellyfin_version"
|
|
|
|
# Update the Chart.yaml with the new version and appVersion
|
|
sed -i "s/^version:.*/version: $new_version/" Chart.yaml
|
|
sed -i "s/^appVersion:.*/appVersion: $jellyfin_version/" Chart.yaml
|
|
|
|
# Output the new chart version for further use
|
|
echo "::set-output name=new_version::$new_version"
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add Chart.yaml
|
|
git commit -m "chore(jellyfin): Bump chart version to ${{ steps.bump_version.outputs.new_version }} and set appVersion to ${{ github.event.inputs.jellyfin_version }}"
|
|
|
|
- name: Push changes
|
|
run: git push
|
|
|
|
- name: Create Git tag
|
|
id: create_tag
|
|
run: |
|
|
new_version="${{ steps.bump_version.outputs.new_version }}"
|
|
git tag "$new_version"
|
|
echo "Tag created: $new_version"
|
|
|
|
- name: Push tag
|
|
run: git push origin "${{ steps.bump_version.outputs.new_version }}"
|