Files
EOS/.github/workflows/bump-version.yml
T
053e22e7fe ci: build the Docker images for the release tag
bump-version.yml pushes the release tag with GITHUB_TOKEN. Events from
GITHUB_TOKEN do not start other workflows, so docker-build.yml never
ran for v0.3.0, and Docker Hub has no 0.3.0 or 0.3 image. bump-version
now starts docker-build.yml for the new tag with a workflow_dispatch
event, which GITHUB_TOKEN may trigger. docker/metadata-action takes the
version tags from the tag ref, also for workflow_dispatch.

Additional changes
Describe the tag and the Docker images in the release process docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-20 22:10:59 +01:00

110 lines
3.9 KiB
YAML

name: Bump Version
# Trigger the workflow on any push to main
on:
push:
branches:
- main
permissions:
contents: write # Required for pushing commits and tags
pull-requests: write # Required to create a pull request
actions: write # Required to start the Docker image build for the release tag
concurrency:
group: bump-version-main
cancel-in-progress: false
jobs:
bump-version:
runs-on: ubuntu-latest
name: Bump Version Workflow
steps:
# --- Step 1: Checkout the repository ---
- name: Checkout repo
uses: actions/checkout@v7
with:
fetch-depth: 0 # Needed to create tags and see full history
# --- Step 2: Set up Python ---
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
# --- Step 3: Calculate version dynamically ---
- name: Calculate version
id: calc
run: |
VERSION=$(python scripts/get_version.py)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Computed version: $VERSION"
# --- Step 4: Skip workflow for development versions ---
- name: Skip if version contains 'dev'
if: contains(steps.calc.outputs.version, 'dev')
run: |
echo "Version contains 'dev'. Skipping release-related steps."
# --- Step 5: Tag release version ---
- name: Tag release version
id: tagging
if: "!contains(steps.calc.outputs.version, 'dev')"
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
TAG="v${{ steps.calc.outputs.version }}"
if git rev-parse --verify "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Skipping."
echo "tagged=false" >> "$GITHUB_OUTPUT"
else
git tag -a "$TAG" -m "Release ${{ steps.calc.outputs.version }}"
git push origin "$TAG"
echo "tagged=true" >> "$GITHUB_OUTPUT"
fi
# --- Step 6: Build the Docker images of the release ---
# The tag pushed with GITHUB_TOKEN does not trigger docker-build.yml; a workflow_dispatch
# event does. Runs before the dev version PR, so a failing PR step does not skip it.
- name: Start Docker image build for the release tag
if: steps.tagging.outputs.tagged == 'true'
run: |
gh workflow run docker-build.yml --ref "$TAG"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: v${{ steps.calc.outputs.version }}
# --- Step 7: Create PR to bump to dev version ---
- name: Bump dev version and create PR
if: "!contains(steps.calc.outputs.version, 'dev')"
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
BRANCH="chore/bump-dev-version-${{ steps.calc.outputs.version }}"
# Skip if branch or PR already exists
if git ls-remote --exit-code --heads origin "$BRANCH" >/dev/null 2>&1; then
echo "Branch $BRANCH already exists. Skipping."
exit 0
fi
git checkout -b "$BRANCH"
VERSION_BASE=$(python scripts/bump_dev_version.py | tail -n1)
if [ -z "$VERSION_BASE" ]; then
echo "Error: bump_dev_version.py returned an empty version."
exit 1
fi
git add src/akkudoktoreos/core/version.py
if git diff --cached --quiet; then
echo "version.py not changed. Skipping."
else
git commit -m "chore: bump dev version to ${VERSION_BASE}"
git push origin "$BRANCH"
gh pr create \
--title "chore: bump dev version to ${VERSION_BASE}" \
--body "Automated dev version bump after release ${{ steps.calc.outputs.version }}." \
--base main \
--head "$BRANCH"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}