-
Notifications
You must be signed in to change notification settings - Fork 8
73 lines (63 loc) · 2.26 KB
/
prep-release.yaml
File metadata and controls
73 lines (63 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright 2025 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: Prepare Release
on:
workflow_call:
inputs:
release:
required: true
type: string
default: dev
outputs:
release_sha:
description: "The SHA that was tagged"
value: ${{ jobs.prep-release.outputs.sha }}
env:
RELEASE: dev
GH_TOKEN: ${{ github.token }}
jobs:
prep-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
sha: ${{ steps.get_sha.outputs.sha }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
with:
ref: main
- name: Get Commit SHA
id: get_sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Update Rolling Release
env:
RELEASE_TAG: ${{ inputs.release || env.RELEASE }}
run: |
echo "Processing release for: $RELEASE_TAG"
# 1. CLEANUP: Check if the release/tag exists and nukes it.
# This ensures the 'dev' tag is free to move to the new commit.
if gh release view "$RELEASE_TAG" > /dev/null 2>&1; then
echo "Existing release found. Deleting '$RELEASE_TAG' to update pointer..."
gh release delete "$RELEASE_TAG" --cleanup-tag -y
else
echo "No existing release for '$RELEASE_TAG'. Creating new one."
fi
# 2. CREATE: Create the release pointing to the latest commit (target main).
echo "Creating release..."
gh release create "$RELEASE_TAG" \
--prerelease \
--target "${{ steps.get_sha.outputs.sha }}" \
--title "$RELEASE_TAG build" \
--generate-notes
echo "Success: $RELEASE_TAG updated to latest commit."