Add auto-increment version and release workflow
All checks were successful
Release / Bump version and tag (push) Successful in 3s
All checks were successful
Release / Bump version and tag (push) Successful in 3s
- New release.yml: bumps patch version, commits with skip-ci marker, tags, creates Gitea release - Build workflows now trigger on v* tags only (not branch push) - Simplified upload steps: use tag directly, retry loop for release lookup - Fix macOS: install jq if missing - Sync python/pyproject.toml version to 0.2.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,7 @@ name: Build Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.11"
|
||||
@@ -65,35 +63,33 @@ jobs:
|
||||
|
||||
# ── Release ──
|
||||
- name: Upload to release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
||||
run: |
|
||||
sudo apt-get install -y jq
|
||||
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
|
||||
# Check if the current commit has a version tag
|
||||
VERSION_TAG=$(git tag --points-at HEAD | grep '^v' | head -1)
|
||||
if [ -n "${VERSION_TAG}" ]; then
|
||||
TAG="${VERSION_TAG}"
|
||||
RELEASE_NAME="Voice to Notes ${TAG}"
|
||||
PRERELEASE=false
|
||||
else
|
||||
TAG="latest"
|
||||
RELEASE_NAME="Voice to Notes (Latest Build)"
|
||||
PRERELEASE=true
|
||||
fi
|
||||
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
RELEASE_NAME="Voice to Notes ${TAG}"
|
||||
echo "Release tag: ${TAG}"
|
||||
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
||||
"${REPO_API}/releases/tags/${TAG}" | jq -r '.id // empty')
|
||||
# Wait for release to be created by the release workflow
|
||||
for i in 1 2 3 4 5; do
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
||||
"${REPO_API}/releases/tags/${TAG}" | jq -r '.id // empty')
|
||||
if [ -n "${RELEASE_ID}" ] && [ "${RELEASE_ID}" != "null" ]; then
|
||||
break
|
||||
fi
|
||||
echo "Release not found yet, waiting 10s... (attempt $i)"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
if [ -z "${RELEASE_ID}" ]; then
|
||||
# Fallback: create release if it still doesn't exist
|
||||
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
|
||||
RELEASE_ID=$(curl -s -X POST \
|
||||
-H "Authorization: token ${BUILD_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated build.\", \"draft\": false, \"prerelease\": ${PRERELEASE}}" \
|
||||
-d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated build.\", \"draft\": false, \"prerelease\": false}" \
|
||||
"${REPO_API}/releases" | jq -r '.id')
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user