Add semantic release: auto-version on push to master
Helm Chart CI & Release / Lint Helm Chart (push) Successful in 2m24s
Helm Chart CI & Release / Semantic Release (push) Failing after 12s

- Patch bump for regular commits/fixes (0.1.0 → 0.1.1)
- Major bump when merging feature/* branches (0.1.1 → 1.0.0)
- Auto-tags, updates Chart.yaml version, packages and publishes

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-19 19:59:18 +00:00
parent 7e4a3eeca2
commit 9c3caeef17
+74 -16
View File
@@ -1,7 +1,9 @@
# FleetDM Stack - Gitea Actions # FleetDM Stack - Gitea Actions
# CI: lint and validate chart on every push # CI: lint on every push
# Release: package and publish on tag push (v*) # Semantic Release: auto-bump version on push to main/master
# Gitea-compatible: uses gitea context and gitea-release-action # - merge from feature/* branch → major bump
# - any other commit (fix, chore, etc.) → patch bump
# Release: package Helm chart and publish to Gitea Releases
name: Helm Chart CI & Release name: Helm Chart CI & Release
@@ -14,12 +16,6 @@ on:
branches: branches:
- main - main
- master - master
# Release when tagging (e.g. git tag v0.1.0)
tag:
- 'v*'
permissions:
contents: read
jobs: jobs:
lint: lint:
@@ -42,23 +38,76 @@ jobs:
helm lint fleetdm-stack/ helm lint fleetdm-stack/
helm template fleetdm-stack fleetdm-stack/ --namespace fleetdm > /dev/null helm template fleetdm-stack fleetdm-stack/ --namespace fleetdm > /dev/null
release: semantic-release:
name: Release Helm Chart name: Semantic Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: lint needs: lint
if: startsWith(gitea.ref, 'refs/tags/v') if: gitea.event_name == 'push'
permissions: permissions:
contents: write contents: write
steps: steps:
- name: Checkout - name: Checkout (full history for tags)
run: | run: |
git clone https://git.produktor.io/${{ gitea.repository }}.git . git clone https://git.produktor.io/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }} git fetch --tags
- name: Determine version bump
id: version
run: |
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -1)
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="v0.0.0"
fi
echo "Latest tag: $LATEST_TAG"
# Strip 'v' prefix and split
VER="${LATEST_TAG#v}"
MAJOR=$(echo "$VER" | cut -d. -f1)
MINOR=$(echo "$VER" | cut -d. -f2)
PATCH=$(echo "$VER" | cut -d. -f3)
# Check if this commit is a merge from a feature/* branch
COMMIT_MSG=$(git log -1 --format='%s' ${{ gitea.sha }})
echo "Commit message: $COMMIT_MSG"
IS_FEATURE="false"
if echo "$COMMIT_MSG" | grep -qiE "^Merge.*feature/"; then
IS_FEATURE="true"
fi
# Also check parent branches for merge commits
if git log -1 --format='%P' ${{ gitea.sha }} | grep -q ' '; then
MERGE_BRANCH=$(git log -1 --format='%s' ${{ gitea.sha }} | grep -oE "feature/[^ '\"]*" || true)
if [ -n "$MERGE_BRANCH" ]; then
IS_FEATURE="true"
fi
fi
if [ "$IS_FEATURE" = "true" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
BUMP="major"
else
PATCH=$((PATCH + 1))
BUMP="patch"
fi
NEW_VER="${MAJOR}.${MINOR}.${PATCH}"
echo "Bump: $BUMP → v${NEW_VER}"
echo "new_version=${NEW_VER}" >> "$GITHUB_OUTPUT"
echo "new_tag=v${NEW_VER}" >> "$GITHUB_OUTPUT"
echo "bump_type=${BUMP}" >> "$GITHUB_OUTPUT"
- name: Install Helm - name: Install Helm
run: | run: |
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Update Chart.yaml version
run: |
sed -i "s/^version: .*/version: ${{ steps.version.outputs.new_version }}/" fleetdm-stack/Chart.yaml
echo "Chart.yaml version set to ${{ steps.version.outputs.new_version }}"
grep '^version:' fleetdm-stack/Chart.yaml
- name: Package chart - name: Package chart
run: | run: |
helm dependency update fleetdm-stack/ helm dependency update fleetdm-stack/
@@ -67,13 +116,22 @@ jobs:
mv fleetdm-stack-*.tgz .tmp/ mv fleetdm-stack-*.tgz .tmp/
ls -la .tmp/ ls -la .tmp/
- name: Create tag
run: |
git config user.name "Gitea Actions"
git config user.email "actions@git.produktor.io"
git tag -a "${{ steps.version.outputs.new_tag }}" -m "Release ${{ steps.version.outputs.new_tag }} (${{ steps.version.outputs.bump_type }})"
git push https://${{ gitea.actor }}:${{ gitea.token }}@git.produktor.io/${{ gitea.repository }}.git "${{ steps.version.outputs.new_tag }}"
- name: Create Gitea Release - name: Create Gitea Release
uses: https://gitea.com/actions/gitea-release-action@v1 uses: https://gitea.com/actions/gitea-release-action@v1
with: with:
server_url: ${{ gitea.server_url }} server_url: ${{ gitea.server_url }}
token: ${{ gitea.token }} token: ${{ gitea.token }}
tag_name: ${{ gitea.ref_name }} tag_name: ${{ steps.version.outputs.new_tag }}
name: FleetDM Stack ${{ gitea.ref_name }} name: FleetDM Stack ${{ steps.version.outputs.new_tag }}
body: | body: |
**${{ steps.version.outputs.bump_type }}** release — `${{ steps.version.outputs.new_tag }}`
Helm chart for FleetDM Server with MySQL and Redis. Helm chart for FleetDM Server with MySQL and Redis.
files: .tmp/*.tgz files: .tmp/*.tgz