-
Notifications
You must be signed in to change notification settings - Fork 170
79 lines (68 loc) · 2.62 KB
/
release.yaml
File metadata and controls
79 lines (68 loc) · 2.62 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
74
75
76
77
78
79
name: Release Chart
on:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
description: 'New version (e.g. 1.2.3). If omitted, bumps based on changelog.'
required: false
type: string
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.CORTEX_HELM_CHART_CI_TOKEN }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v5
with:
version: v3.12.1
- name: Bump Version
run: make bump-version VERSION="${{ inputs.version }}"
- name: Get New Version
id: version
run: |
new_version=$(grep '^version:' Chart.yaml | awk '{print $2}')
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Update README
run: make README.md
- name: Package Chart
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build
helm package . -d docs
helm repo index ./docs/ --url https://cortexproject.github.io/cortex-helm-chart
- name: Create or Update Pull Request
env:
GITHUB_TOKEN: ${{ secrets.CORTEX_HELM_CHART_CI_TOKEN }}
run: |
git checkout -b release-${{ steps.version.outputs.new_version }}
git add Chart.yaml README.md CHANGELOG.md docs/
git commit -s -m "Release ${{ steps.version.outputs.new_version }}"
git push --force origin release-${{ steps.version.outputs.new_version }}
# Check if a PR already exists for this head branch
existing_pr=$(gh pr list --head release-${{ steps.version.outputs.new_version }} --json number --jq '.[0].number')
if [ -n "$existing_pr" ]; then
echo "PR #$existing_pr already exists — updating title/body"
gh pr edit "$existing_pr" \
--title "Release ${{ steps.version.outputs.new_version }}" \
--body "Automated release PR for version ${{ steps.version.outputs.new_version }}"
else
gh pr create \
--title "Release ${{ steps.version.outputs.new_version }}" \
--body "Automated release PR for version ${{ steps.version.outputs.new_version }}" \
--base ${{ github.ref_name }} \
--head release-${{ steps.version.outputs.new_version }}
fi