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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 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:' charts/jellyfin/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/" charts/jellyfin/Chart.yaml sed -i "s/^appVersion:.*/appVersion: $jellyfin_version/" charts/jellyfin/Chart.yaml # Output the new chart version for further use echo "new_version=$new_version" >> $GITHUB_OUTPUT - 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 charts/jellyfin/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 uses: ad-m/github-push-action@master with: github_token: ${{ secrets.JF_BOT_TOKEN }} - 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 changes uses: ad-m/github-push-action@master with: github_token: ${{ secrets.JF_BOT_TOKEN }} tags: true