forked from rancher/rancher-product-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate-release-maintenance.yaml
More file actions
73 lines (63 loc) · 2.67 KB
/
generate-release-maintenance.yaml
File metadata and controls
73 lines (63 loc) · 2.67 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
name: Generate Release Maintenance
on:
workflow_dispatch:
inputs:
release_tag:
description: 'The release tag (e.g., v2.11.10-alpha1)'
required: true
release_date:
description: 'The release date (e.g., Jan 28, 2026)'
required: true
prime:
description: 'Is this version available in Prime? (Default: y)'
required: false
default: 'y'
community:
description: 'Is this version available in Community? (Default: y)'
required: false
default: 'y'
jobs:
build-and-commit:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Release Maintenance
run: ./release-maintenance.sh -t "${{ inputs.release_tag }}" -d "${{ inputs.release_date }}" --prime "${{ inputs.prime }}" --community "${{ inputs.community }}"
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ inputs.release_tag }}
DATE: ${{ inputs.release_date }}
PRIME: ${{ inputs.prime }}
COMMUNITY: ${{ inputs.community }}
run: |
# Extract version from tag (e.g., v2.11.10-alpha1 -> v2.11.10)
VERSION=${TAG%%-*}
BRANCH_NAME="${VERSION}-maintenance"
if git ls-remote --heads origin "$VERSION" | grep -q "$VERSION"; then
BASE_BRANCH="$VERSION"
else
BASE_BRANCH="main"
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "$VERSION - Release Maintenance"
git push -f origin "$BRANCH_NAME"
PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_BRANCH" --json number --jq '.[0].number')
if [[ -n "$PR_NUMBER" && "$PR_NUMBER" != "null" ]]; then
gh pr edit "$PR_NUMBER" \
--title "$VERSION - Release Maintenance" \
--body "Automated release maintenance updates for version $VERSION."$'\n'"Command executed: \`./release-maintenance.sh -t \"$TAG\" -d \"$DATE\" --prime \"$PRIME\" --community \"$COMMUNITY\"\`"
else
gh pr create \
--title "$VERSION - Release Maintenance" \
--body "Automated release maintenance updates for version $VERSION."$'\n'"Command executed: \`./release-maintenance.sh -t \"$TAG\" -d \"$DATE\" --prime \"$PRIME\" --community \"$COMMUNITY\"\`" \
--base "$BASE_BRANCH" \
--head "$BRANCH_NAME"
fi