From eedbf3fbe679cbac8aecabf774627b124a59e97f Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 18 Feb 2026 11:31:16 -0600 Subject: [PATCH] ci: Add CalVer auto-tagging to deploy workflow Generates YYYY.M.BUILD version tags on each successful deploy using the Gitea API (bypasses branch protection). Matches the pattern used in Paper Dynasty workflows. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index e898552..5f2b21a 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -10,6 +10,25 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history for tag counting + + # Generate CalVer: YYYY.MM.BUILD + # BUILD = count of tags matching current month + 1 + - name: Generate CalVer version + id: meta + run: | + YEAR=$(date -u +%Y) + MONTH=$(date -u +%-m) + PREFIX="${YEAR}.${MONTH}." + + git fetch --tags + BUILD=$(git tag -l "${PREFIX}*" | wc -l) + BUILD=$((BUILD + 1)) + + VERSION="${PREFIX}${BUILD}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "CalVer version: ${VERSION}" - name: Setup Node.js uses: actions/setup-node@v4 @@ -42,3 +61,14 @@ jobs: script: | chown -R 1000:1000 /opt/foundry/data/Data/systems/vagabond/ cd /opt/foundry && docker compose restart foundry + + # Create git tag via Gitea API (avoids branch protection issues) + - name: Tag release + if: success() + run: | + curl -s -X POST \ + -H "Authorization: token ${{ github.token }}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${{ steps.meta.outputs.version }}\", \"target\": \"${{ github.sha }}\", \"name\": \"${{ steps.meta.outputs.version }}\"}" \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/tags" + echo "Created tag ${{ steps.meta.outputs.version }}" -- 2.25.1