forked from signalfx/splunk-otel-collector-chart
-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (64 loc) · 2.82 KB
/
release_drafter.yaml
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
name: Check for new chart release
# Description:
# This workflow prepares a new release of the helm chart by updating chart and app versions as well as creating a PR.
# A release PR will be created in these cases.
# - When a user kicks offs this workflow manually. A user can specify the CHART_VERSION and APP_VERSION used for the new release.
# - When the cron schedule kicks off the job and there is a version difference for the collector application, then a chart release draft PR will be created with the version automatically incremented appropriately.
on:
schedule:
# Run every 12 hours at 55 minutes past the hour.
- cron: "55 */12 * * *"
workflow_dispatch:
inputs:
CHART_VERSION:
description: 'Optionally overrides the chart version in Chart.yaml.'
required: false
default: ''
APP_VERSION:
description: 'Optionally overrides the app version in Chart.yaml.'
required: false
default: ''
DEBUG:
description: 'Enable debug mode for the script.'
required: false
default: 'false'
jobs:
prepare_release:
runs-on: ubuntu-latest
env:
CHART_VERSION: ${{ github.event.inputs.CHART_VERSION }}
APP_VERSION: ${{ github.event.inputs.APP_VERSION }}
DEBUG: ${{ github.event.inputs.DEBUG }}
steps:
- uses: actions/checkout@v4
- name: Install tools
run: make install-tools
- name: Prepare Release
id: prepare_release
run: |
make prepare-release CHART_VERSION=$CHART_VERSION APP_VERSION=$APP_VERSION CREATE_BRANCH=false DEBUG=$DEBUG
- name: Check if PR is already open
id: check_if_pr_open
run: |
echo "PR_NEEDED=1" >> "$GITHUB_OUTPUT"
git fetch origin
# Directly check if the feature branch exists and has the same changes in the remote repository
if git ls-remote --heads origin update-release > /dev/null; then
if git diff --no-ext-diff --quiet origin/update-release -- helm-charts; then
echo "PR_NEEDED=0" >> "$GITHUB_OUTPUT"
fi
fi
- name: Open PR for Version Update
id: open_pr
if: ${{ steps.prepare_release.outputs.NEED_UPDATE == 1 && steps.check_if_pr_open.outputs.PR_NEEDED == 1 }}
uses: peter-evans/create-pull-request@v6
with:
commit-message: Prepare release v${{ steps.prepare_release.outputs.LATEST_CHART_VERSION }}
title: Prepare release v${{ steps.prepare_release.outputs.LATEST_CHART_VERSION }}
body: |
Description
- Release Helm chart version ${{ steps.prepare_release.outputs.LATEST_CHART_VERSION }}
- Includes collector version ${{ steps.prepare_release.outputs.LATEST_APP_VERSION }}
branch: update-release
base: main
delete-branch: true