Add auto-increment patch version to build workflow
Leave version input empty to auto-increment patch (v_._.+1) from the latest release. First release starts at v1.0.0. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9b87542cae
commit
b45e2cb862
1 changed files with 34 additions and 11 deletions
|
|
@ -8,7 +8,7 @@
|
|||
#
|
||||
# Usage:
|
||||
# 1. Go to Actions > Build BlumeOps > Run workflow
|
||||
# 2. Enter a version tag (e.g., v1.2.0)
|
||||
# 2. Enter a version tag (e.g., v1.2.0) or leave empty to auto-increment patch
|
||||
# 3. The workflow creates a release with attached artifacts
|
||||
#
|
||||
# Documentation asset URL:
|
||||
|
|
@ -20,21 +20,44 @@ on:
|
|||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version tag (e.g., v1.2.0)'
|
||||
required: true
|
||||
description: 'Version (e.g., v1.2.0) or empty to auto-increment patch (v_._.+1)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: k8s
|
||||
steps:
|
||||
- name: Validate version
|
||||
- name: Resolve version
|
||||
id: version
|
||||
run: |
|
||||
VERSION="${{ inputs.version }}"
|
||||
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Error: Version must be in format vX.Y.Z (e.g., v1.0.0)"
|
||||
exit 1
|
||||
INPUT_VERSION="${{ inputs.version }}"
|
||||
|
||||
if [ -n "$INPUT_VERSION" ]; then
|
||||
# User provided a version - validate it
|
||||
if [[ ! "$INPUT_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Error: Version must be in format vX.Y.Z (e.g., v1.0.0)"
|
||||
exit 1
|
||||
fi
|
||||
VERSION="$INPUT_VERSION"
|
||||
echo "Using provided version: $VERSION"
|
||||
else
|
||||
# Auto-increment patch version from latest release
|
||||
echo "Fetching latest release..."
|
||||
LATEST=$(curl -sf "https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases/latest" | jq -r '.tag_name // empty')
|
||||
|
||||
if [ -z "$LATEST" ]; then
|
||||
VERSION="v1.0.0"
|
||||
echo "No previous releases found, starting at: $VERSION"
|
||||
else
|
||||
# Parse vX.Y.Z and increment patch
|
||||
VERSION=$(echo "$LATEST" | awk -F. '{print $1"."$2"."$3+1}')
|
||||
echo "Auto-incremented from $LATEST to: $VERSION"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "Building BlumeOps release: $VERSION"
|
||||
|
||||
- name: Checkout
|
||||
|
|
@ -42,7 +65,7 @@ jobs:
|
|||
|
||||
- name: Build docs
|
||||
run: |
|
||||
VERSION="${{ inputs.version }}"
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
echo "Node version: $(node --version)"
|
||||
echo "NPM version: $(npm --version)"
|
||||
|
||||
|
|
@ -75,7 +98,7 @@ jobs:
|
|||
|
||||
- name: Create release
|
||||
run: |
|
||||
VERSION="${{ inputs.version }}"
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TARBALL="docs-${VERSION}.tar.gz"
|
||||
|
||||
echo "Creating release $VERSION..."
|
||||
|
|
@ -121,7 +144,7 @@ jobs:
|
|||
|
||||
- name: Summary
|
||||
run: |
|
||||
VERSION="${{ inputs.version }}"
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TARBALL="docs-${VERSION}.tar.gz"
|
||||
echo "================================================"
|
||||
echo "BlumeOps Release: $VERSION"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue