ci: switch release workflow to tag-driven
Trigger on `push: tags` instead of `workflow_dispatch`. The pushed tag name is the version — removes the bump-input + compute-and-create-tag dance, avoiding accidental major bumps from the manual dispatch form. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,9 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
push:
|
||||||
inputs:
|
tags:
|
||||||
bump:
|
- 'v*'
|
||||||
description: "Version bump type"
|
|
||||||
required: true
|
|
||||||
default: "patch"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- patch
|
|
||||||
- minor
|
|
||||||
- major
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@@ -45,25 +37,17 @@ jobs:
|
|||||||
cd repo
|
cd repo
|
||||||
git checkout ${{ gitea.ref_name }}
|
git checkout ${{ gitea.ref_name }}
|
||||||
|
|
||||||
- name: Compute version
|
- name: Resolve version from tag
|
||||||
working-directory: repo
|
working-directory: repo
|
||||||
run: |
|
run: |
|
||||||
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n1)
|
VERSION="${{ gitea.ref_name }}"
|
||||||
if [ -z "$LATEST_TAG" ]; then
|
PREV_TAG=$(git tag -l 'v*' --sort=-v:refname | grep -vxF "$VERSION" | head -n1)
|
||||||
LATEST_TAG="v0.0.0"
|
if [ -z "$PREV_TAG" ]; then
|
||||||
|
PREV_TAG="v0.0.0"
|
||||||
fi
|
fi
|
||||||
MAJOR=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f1)
|
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||||
MINOR=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f2)
|
echo "PREV_TAG=$PREV_TAG" >> "$GITHUB_ENV"
|
||||||
PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d. -f3)
|
echo "Releasing $VERSION (previous: $PREV_TAG)"
|
||||||
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"
|
|
||||||
|
|
||||||
- name: Generate changelog
|
- name: Generate changelog
|
||||||
working-directory: repo
|
working-directory: repo
|
||||||
@@ -77,14 +61,6 @@ jobs:
|
|||||||
echo "$CHANGELOG" >> "$GITHUB_ENV"
|
echo "$CHANGELOG" >> "$GITHUB_ENV"
|
||||||
echo "CHANGELOG_EOF" >> "$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
|
- name: Build and push Docker image
|
||||||
working-directory: repo
|
working-directory: repo
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
12
CLAUDE.md
12
CLAUDE.md
@@ -64,16 +64,12 @@ bun run build # Vite build → dist/client/
|
|||||||
|
|
||||||
## Releasing
|
## 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.
|
To release, tag the desired commit on `Develop` and push:
|
||||||
|
|
||||||
Trigger via Gitea API:
|
|
||||||
```bash
|
```bash
|
||||||
curl -s -X POST "https://gitea.jeanlucmakiola.de/api/v1/repos/makiolaj/GearBox/actions/workflows/release.yml/dispatches" \
|
git tag v2.3.0
|
||||||
-H "Authorization: token <GITEA_TOKEN>" \
|
git push origin v2.3.0
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"ref": "Develop", "inputs": {"bump": "patch"}}' # patch | minor | major
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Branching
|
## Branching
|
||||||
|
|||||||
Reference in New Issue
Block a user