ci: Version-Bump-Semantik im Deploy-Workflow
This commit is contained in:
@@ -1,9 +1,18 @@
|
|||||||
name: Deploy to Production
|
name: Deploy to Production
|
||||||
run-name: 🚀 Deploy by @${{ gitea.actor }}
|
run-name: 🚀 Deploy ${{ inputs.bump_version || 'patch' }} by @${{ gitea.actor }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
bump_version:
|
||||||
|
description: 'Version bump (Major=x.0.0, Minor=1.x.0 features, Patch=1.0.x fixes)'
|
||||||
|
required: false
|
||||||
|
default: 'patch'
|
||||||
|
type: string
|
||||||
|
options:
|
||||||
|
- 'patch'
|
||||||
|
- 'minor'
|
||||||
|
- 'major'
|
||||||
service:
|
service:
|
||||||
description: 'Service to deploy (empty = all)'
|
description: 'Service to deploy (empty = all)'
|
||||||
required: false
|
required: false
|
||||||
@@ -36,6 +45,47 @@ jobs:
|
|||||||
--exclude='frontend/node_modules' \
|
--exclude='frontend/node_modules' \
|
||||||
${{ gitea.workspace }}/ /workspace/nexus/
|
${{ gitea.workspace }}/ /workspace/nexus/
|
||||||
|
|
||||||
|
- name: Version Bump
|
||||||
|
working-directory: /workspace/nexus
|
||||||
|
run: |
|
||||||
|
# Read current version
|
||||||
|
CURRENT_VERSION=$(cat VERSION)
|
||||||
|
echo "📦 Current version: $CURRENT_VERSION"
|
||||||
|
|
||||||
|
# Parse major.minor.patch
|
||||||
|
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
|
||||||
|
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
|
||||||
|
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
|
||||||
|
|
||||||
|
# Bump according to input
|
||||||
|
case "${{ inputs.bump_version }}" in
|
||||||
|
major)
|
||||||
|
MAJOR=$((MAJOR + 1))
|
||||||
|
MINOR=0
|
||||||
|
PATCH=0
|
||||||
|
;;
|
||||||
|
minor)
|
||||||
|
MINOR=$((MINOR + 1))
|
||||||
|
PATCH=0
|
||||||
|
;;
|
||||||
|
patch|*)
|
||||||
|
PATCH=$((PATCH + 1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
echo "🏷️ New version: $NEW_VERSION"
|
||||||
|
echo "$NEW_VERSION" > VERSION
|
||||||
|
|
||||||
|
# Commit & push version bump
|
||||||
|
git config user.email "devops@noveria.net"
|
||||||
|
git config user.name "DevOps"
|
||||||
|
git add VERSION
|
||||||
|
git commit -m "chore: bump version to v${NEW_VERSION} [skip ci]"
|
||||||
|
git tag "v${NEW_VERSION}"
|
||||||
|
git push "https://devops:${{ secrets.GIT_TOKEN }}@git.noveria.net/bao/nexus.git" HEAD:main --tags
|
||||||
|
echo "✅ Version bumped to v${NEW_VERSION}"
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
run: docker buildx create --use 2>/dev/null || true
|
run: docker buildx create --use 2>/dev/null || true
|
||||||
|
|
||||||
@@ -46,7 +96,7 @@ jobs:
|
|||||||
if [ "${{ inputs.no_cache }}" = "true" ]; then
|
if [ "${{ inputs.no_cache }}" = "true" ]; then
|
||||||
BUILD_ARGS="--no-cache"
|
BUILD_ARGS="--no-cache"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${{ inputs.service }}" ]; then
|
if [ -n "${{ inputs.service }}" ]; then
|
||||||
echo "🚀 Deploying service: ${{ inputs.service }}"
|
echo "🚀 Deploying service: ${{ inputs.service }}"
|
||||||
docker compose build $BUILD_ARGS ${{ inputs.service }}
|
docker compose build $BUILD_ARGS ${{ inputs.service }}
|
||||||
|
|||||||
Reference in New Issue
Block a user