|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Release RC |
| 16 | + |
| 17 | +on: |
| 18 | + workflow_dispatch: |
| 19 | + inputs: |
| 20 | + version: |
| 21 | + description: 'RC version (e.g. 8.3.0-rc01)' |
| 22 | + required: true |
| 23 | + branch: |
| 24 | + description: 'Branch to release from' |
| 25 | + required: true |
| 26 | + default: 'main' |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: write |
| 30 | + |
| 31 | +jobs: |
| 32 | + release-rc: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v6 |
| 37 | + with: |
| 38 | + ref: ${{ inputs.branch }} |
| 39 | + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} |
| 40 | + |
| 41 | + - name: Configure git |
| 42 | + run: | |
| 43 | + git config user.name "github-actions[bot]" |
| 44 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 45 | +
|
| 46 | + - name: Update version files |
| 47 | + env: |
| 48 | + VERSION: ${{ inputs.version }} |
| 49 | + run: | |
| 50 | + # .release-please-manifest.json |
| 51 | + sed -i 's/"\." *: *"[^"]*"/".": "'"$VERSION"'"/' .release-please-manifest.json |
| 52 | +
|
| 53 | + # build.gradle.kts (between release-please markers) |
| 54 | + sed -i 's/version = "[^"]*"/version = "'"$VERSION"'"/' build.gradle.kts |
| 55 | +
|
| 56 | + # Files with x-release-please-version inline marker |
| 57 | + for file in README.md llm-integration-prompt.md .gemini/skills/android-maps-compose/SKILL.md; do |
| 58 | + if [ -f "$file" ]; then |
| 59 | + sed -i "/x-release-please-version/s/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[a-zA-Z0-9.-]*/$VERSION/" "$file" |
| 60 | + fi |
| 61 | + done |
| 62 | +
|
| 63 | + - name: Commit and push |
| 64 | + env: |
| 65 | + VERSION: ${{ inputs.version }} |
| 66 | + run: | |
| 67 | + git add \ |
| 68 | + .release-please-manifest.json \ |
| 69 | + build.gradle.kts \ |
| 70 | + README.md \ |
| 71 | + llm-integration-prompt.md \ |
| 72 | + .gemini/skills/android-maps-compose/SKILL.md |
| 73 | + git commit -m "chore: release v${VERSION}" |
| 74 | + git push origin "${{ inputs.branch }}" |
| 75 | +
|
| 76 | + - name: Tag and create pre-release |
| 77 | + env: |
| 78 | + VERSION: ${{ inputs.version }} |
| 79 | + GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} |
| 80 | + run: | |
| 81 | + git tag "v${VERSION}" |
| 82 | + git push origin "v${VERSION}" |
| 83 | +
|
| 84 | + # Find the previous tag to use as baseline for release notes |
| 85 | + PREVIOUS_TAG=$(git tag -l 'v*' --sort=-version:refname --merged HEAD | grep -v "v${VERSION}" | head -1) |
| 86 | +
|
| 87 | + if [ -n "$PREVIOUS_TAG" ]; then |
| 88 | + gh release create "v${VERSION}" \ |
| 89 | + --title "v${VERSION}" \ |
| 90 | + --generate-notes \ |
| 91 | + --notes-start-tag "$PREVIOUS_TAG" \ |
| 92 | + --prerelease |
| 93 | + else |
| 94 | + gh release create "v${VERSION}" \ |
| 95 | + --title "v${VERSION}" \ |
| 96 | + --generate-notes \ |
| 97 | + --prerelease |
| 98 | + fi |
0 commit comments