Skip to content

Setup Release Branch #1

Setup Release Branch

Setup Release Branch #1

Workflow file for this run

---
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Setup Release Branch
on:
create:
jobs:
configure-release:
# Only run when a branch starting with 'release/' is created
if: >-
github.event.ref_type == 'branch' &&
startsWith(github.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Checkout the newly created branch
ref: ${{ github.ref_name }}
- name: Update mkdocs.yml version
run: |
# Extract version from branch name (release/2026-01-23 -> 2026-01-23)
VERSION=${GITHUB_REF_NAME#release/}
echo "Configuring release version: $VERSION"
# Replace 'ucp_version: "draft"' with the actual version
sed -i "s/ucp_version: \"draft\"/ucp_version: \"$VERSION\"/" mkdocs.yml
# Verify the change
grep "ucp_version:" mkdocs.yml
- name: Commit and Push
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add mkdocs.yml
# Only commit if there are changes
if git diff --staged --quiet; then
echo "No changes to commit (version might already be set)"
else
git commit -m "chore: bake version $VERSION into mkdocs.yml"
git push origin ${{ github.ref_name }}
fi