| # Copyright (C) 2026 The Android Open Source Project |
| # |
| # 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. |
| |
| # Creates a draft GitHub Release on vX.Y tag push. |
| # |
| # The body is pre-populated with the matching CHANGELOG section as a |
| # starting point. A maintainer is expected to edit it into full prose |
| # release notes before clicking `finalize-release` to publish. |
| # |
| # Idempotent: re-running on an existing tag re-creates the draft only if |
| # one does not exist; it never clobbers a release that has already been |
| # published or edited. |
| |
| name: Draft release |
| |
| on: |
| push: |
| tags: |
| - 'v[0-9]+.[0-9]+' |
| |
| permissions: |
| contents: write # Required to create the release |
| |
| jobs: |
| draft: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| with: |
| ref: ${{ github.ref }} |
| |
| - name: Extract CHANGELOG section for this tag |
| run: | |
| python3 tools/release/extract_changelog_section.py \ |
| "${{ github.ref_name }}" > /tmp/release_body.txt |
| echo "--- Draft release body ---" |
| cat /tmp/release_body.txt |
| |
| - name: Create draft release (if missing) |
| env: |
| GH_TOKEN: ${{ github.token }} |
| run: | |
| TAG="${{ github.ref_name }}" |
| if gh release view "$TAG" > /dev/null 2>&1; then |
| echo "Release $TAG already exists — leaving body untouched." |
| else |
| gh release create "$TAG" \ |
| --draft \ |
| --title "Perfetto $TAG" \ |
| --notes-file /tmp/release_body.txt |
| fi |