Skip to content

Bump and Release

Bump and Release #66

name: Bump and Release
# Manually bumps plugin.cfg + pyproject.toml, commits, tags, pushes, and
# then dispatches release.yml against the new tag — release.yml publishes
# to PyPI and creates the GitHub Release with the plugin ZIP.
on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
# actions: write is required so the "Trigger release workflow" step can
# call `gh workflow run release.yml` using the default GITHUB_TOKEN —
# without it the dispatch API returns "Resource not accessible by
# integration".
actions: write
## Block telemetry from CI — same rationale as ci.yml.
env:
GODOT_AI_DISABLE_TELEMETRY: "true"
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Read current version
id: current
run: |
version=$(grep '^version=' plugin/addons/godot_ai/plugin.cfg | sed 's/version="//' | sed 's/"//')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Compute new version
id: next
run: |
IFS='.' read -r major minor patch <<< "${{ steps.current.outputs.version }}"
case "${{ inputs.bump }}" in
major) major=$((major + 1)); minor=0; patch=0 ;;
minor) minor=$((minor + 1)); patch=0 ;;
patch) patch=$((patch + 1)) ;;
esac
echo "version=${major}.${minor}.${patch}" >> "$GITHUB_OUTPUT"
- name: Update version files
run: |
NEW="${{ steps.next.outputs.version }}"
OLD="${{ steps.current.outputs.version }}"
sed -i "s/version=\"${OLD}\"/version=\"${NEW}\"/" plugin/addons/godot_ai/plugin.cfg
sed -i "s/^version = \"${OLD}\"/version = \"${NEW}\"/" pyproject.toml
- name: Commit, tag, and push
run: |
NEW="${{ steps.next.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add plugin/addons/godot_ai/plugin.cfg pyproject.toml
git commit -m "Bump version to ${NEW}"
git tag "v${NEW}"
git push origin main --tags
- name: Trigger release workflow
# The tag push above does NOT fire release.yml on its own — pushes
# authenticated by GITHUB_TOKEN are blocked from triggering other
# workflows (GitHub anti-loop safeguard). workflow_dispatch is the
# documented exception, so dispatch release.yml explicitly against
# the new tag ref.
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW="${{ steps.next.outputs.version }}"
gh workflow run release.yml --ref "v${NEW}"