All checks were successful
Release / Bump version and tag (push) Successful in 7s
Previously per-OS build workflows triggered on tag push events, but
Gitea doesn't fire events for tags pushed by other workflows. Now:
- release.yml dispatches build-app-{linux,windows,macos}.yml via
the Gitea API after creating the tag and release
- sidecar-release.yml dispatches build-sidecar-{linux,windows,macos}.yml
Per-OS workflows changed from push+dispatch triggers to dispatch-only
with tag as a required input. To re-run a failed build for the same
version, just dispatch the specific OS workflow with the same tag --
upload logic replaces existing assets automatically.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
92 lines
3.6 KiB
YAML
92 lines
3.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
bump-version:
|
|
name: Bump version and tag
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
new_version: ${{ steps.bump.outputs.new_version }}
|
|
tag: ${{ steps.bump.outputs.tag }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
|
|
- name: Bump patch version
|
|
id: bump
|
|
run: |
|
|
CURRENT=$(grep '"version"' package.json | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/')
|
|
echo "Current version: ${CURRENT}"
|
|
|
|
MAJOR=$(echo "${CURRENT}" | cut -d. -f1)
|
|
MINOR=$(echo "${CURRENT}" | cut -d. -f2)
|
|
PATCH=$(echo "${CURRENT}" | cut -d. -f3)
|
|
NEW_PATCH=$((PATCH + 1))
|
|
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
|
echo "New version: ${NEW_VERSION}"
|
|
|
|
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json
|
|
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" src-tauri/tauri.conf.json
|
|
sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" src-tauri/Cargo.toml
|
|
sed -i "s/__version__ = \"${CURRENT}\"/__version__ = \"${NEW_VERSION}\"/" version.py
|
|
sed -i "s/__version_info__ = .*/__version_info__ = (${MAJOR}, ${MINOR}, ${NEW_PATCH})/" version.py
|
|
|
|
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
|
echo "tag=v${NEW_VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Commit and tag
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
NEW_VERSION="${{ steps.bump.outputs.new_version }}"
|
|
git add package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml version.py
|
|
git commit -m "chore: bump version to ${NEW_VERSION} [skip ci]"
|
|
git tag "v${NEW_VERSION}"
|
|
|
|
REMOTE_URL=$(git remote get-url origin | sed "s|://|://gitea-actions:${BUILD_TOKEN}@|")
|
|
git pull --rebase "${REMOTE_URL}" main || true
|
|
git push "${REMOTE_URL}" HEAD:main
|
|
git push "${REMOTE_URL}" "v${NEW_VERSION}"
|
|
|
|
- name: Create Gitea release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ steps.bump.outputs.tag }}"
|
|
RELEASE_NAME="Local Transcription ${TAG}"
|
|
|
|
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\": false}" \
|
|
"${REPO_API}/releases"
|
|
echo "Created release: ${RELEASE_NAME}"
|
|
|
|
- name: Trigger per-OS app builds
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ steps.bump.outputs.tag }}"
|
|
|
|
for workflow in build-app-linux.yml build-app-windows.yml build-app-macos.yml; do
|
|
echo "Dispatching ${workflow} for ${TAG}..."
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"ref\": \"main\", \"inputs\": {\"tag\": \"${TAG}\"}}" \
|
|
"${REPO_API}/actions/workflows/${workflow}/dispatches")
|
|
echo " -> HTTP ${HTTP_CODE}"
|
|
done
|