diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 64d3e5a..ca3755d 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,17 +1,9 @@ name: Release on: - workflow_dispatch: - inputs: - bump: - description: "Version bump type" - required: true - default: "patch" - type: choice - options: - - patch - - minor - - major + push: + tags: + - 'v*' jobs: ci: @@ -45,25 +37,17 @@ jobs: cd repo git checkout ${{ gitea.ref_name }} - - name: Compute version + - name: Resolve version from tag working-directory: repo run: | - LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n1) - if [ -z "$LATEST_TAG" ]; then - LATEST_TAG="v0.0.0" + VERSION="${{ gitea.ref_name }}" + PREV_TAG=$(git tag -l 'v*' --sort=-v:refname | grep -vxF "$VERSION" | head -n1) + if [ -z "$PREV_TAG" ]; then + PREV_TAG="v0.0.0" fi - MAJOR=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f1) - MINOR=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f2) - PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f3) - case "${{ gitea.event.inputs.bump }}" in - major) MAJOR=$((MAJOR+1)); MINOR=0; PATCH=0 ;; - minor) MINOR=$((MINOR+1)); PATCH=0 ;; - patch) PATCH=$((PATCH+1)) ;; - esac - NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" - echo "VERSION=$NEW_VERSION" >> "$GITHUB_ENV" - echo "PREV_TAG=$LATEST_TAG" >> "$GITHUB_ENV" - echo "New version: $NEW_VERSION" + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "PREV_TAG=$PREV_TAG" >> "$GITHUB_ENV" + echo "Releasing $VERSION (previous: $PREV_TAG)" - name: Generate changelog working-directory: repo @@ -77,14 +61,6 @@ jobs: echo "$CHANGELOG" >> "$GITHUB_ENV" echo "CHANGELOG_EOF" >> "$GITHUB_ENV" - - name: Create and push tag - working-directory: repo - run: | - git config user.name "Gitea Actions" - git config user.email "actions@gitea.jeanlucmakiola.de" - git tag -a "$VERSION" -m "Release $VERSION" - git push origin "$VERSION" - - name: Build and push Docker image working-directory: repo run: | diff --git a/CLAUDE.md b/CLAUDE.md index 7914ae1..b014af2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -64,16 +64,12 @@ bun run build # Vite build → dist/client/ ## Releasing -Releases are managed by a Gitea Actions workflow (`.gitea/workflows/release.yml`). **Never create tags or releases manually** — always trigger the pipeline. +Releases are tag-driven. The Gitea Actions workflow (`.gitea/workflows/release.yml`) triggers on any pushed tag matching `v*` — it runs CI (lint, test, build), generates a changelog from the previous tag, builds and pushes a Docker image, and creates a Gitea release. The version comes from the tag name. -The workflow runs CI (lint, test, build), computes the next version from the latest tag, generates a changelog, creates the tag, builds and pushes a Docker image, and creates a Gitea release. - -Trigger via Gitea API: +To release, tag the desired commit on `Develop` and push: ```bash -curl -s -X POST "https://gitea.jeanlucmakiola.de/api/v1/repos/makiolaj/GearBox/actions/workflows/release.yml/dispatches" \ - -H "Authorization: token " \ - -H "Content-Type: application/json" \ - -d '{"ref": "Develop", "inputs": {"bump": "patch"}}' # patch | minor | major +git tag v2.3.0 +git push origin v2.3.0 ``` ## Branching