Skip to content

Minor: Add values file preprocessor #11

Minor: Add values file preprocessor

Minor: Add values file preprocessor #11

Workflow file for this run

name: Merge
on:
pull_request:
types:
- closed
jobs:
release:
name: Release
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Git
run: |
username="${{ github.event.pull_request.user.login }}"
email="${{ secrets.DEFAULT_EMAIL }}"
echo "Setting up Git with username: $username"
echo "Setting up Git with email: $email"
git config --global user.name "$username"
git config --global user.email "$email"
- name: Get the latest tag
id: get-latest-tag
run: |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.0.0")
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
echo "tag: $latest_tag"
- name: Determine next version
id: determine-version
run: |
# Extract the branch prefix from the PR's base ref
branch="${{ github.event.pull_request.head.ref }}"
echo "Branch: $branch"
latest_tag="${{ env.latest_tag }}"
IFS='.' read -r major minor patch <<< "${latest_tag#v}"
if [[ $branch == "minor/"* ]]; then
minor=$((minor + 1))
patch=0
elif [[ $branch == "patch/"* ]]; then
patch=$((patch + 1))
elif [[ $branch == "major/"* ]]; then
major=$((major + 1))
minor=0
patch=0
else
echo "Branch prefix '$branch' does not affect versioning. Skipping release."
exit 0
fi
new_tag="v$major.$minor.$patch"
echo "new_tag=$new_tag" >> $GITHUB_ENV
echo "Determined new version: $new_tag"
- name: Create tag
if: env.new_tag != ''
run: |
git tag "${{ env.new_tag }}"
git push origin "${{ env.new_tag }}"
- name: Run GoReleaser
if: env.new_tag != ''
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}