gitea-actions/calver/action.yml
Cal Corum 7e458f30f6 Add shared composite actions: calver, gitea-tag, discord-notify
Centralizes duplicated CI/CD steps from Paper Dynasty, Major Domo,
and Vagabond workflows into reusable composite actions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:41:36 -06:00

51 lines
1.5 KiB
YAML

# CalVer Version Generator
# Generates YYYY.MM.BUILD version from git tags
# BUILD = count of tags matching current month + 1
name: CalVer Version
description: Generate a CalVer (YYYY.MM.BUILD) version from git tags
outputs:
version:
description: CalVer version (e.g., 2026.2.5)
value: ${{ steps.calver.outputs.version }}
sha_short:
description: Short commit SHA (7 chars)
value: ${{ steps.calver.outputs.sha_short }}
version_sha:
description: Version with SHA suffix (e.g., 2026.2.5-abc1234)
value: ${{ steps.calver.outputs.version_sha }}
branch:
description: Current branch name
value: ${{ steps.calver.outputs.branch }}
timestamp:
description: UTC timestamp in ISO 8601 format
value: ${{ steps.calver.outputs.timestamp }}
runs:
using: composite
steps:
- name: Generate CalVer version
id: calver
shell: bash
run: |
YEAR=$(date -u +%Y)
MONTH=$(date -u +%-m)
PREFIX="${YEAR}.${MONTH}."
# Count existing tags for this month
git fetch --tags
BUILD=$(git tag -l "${PREFIX}*" | wc -l)
BUILD=$((BUILD + 1))
VERSION="${PREFIX}${BUILD}"
SHA_SHORT=$(echo "$GITHUB_SHA" | cut -c1-7)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
echo "version_sha=${VERSION}-${SHA_SHORT}" >> $GITHUB_OUTPUT
echo "branch=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "CalVer version: ${VERSION}"