-
Notifications
You must be signed in to change notification settings - Fork 25
95 lines (82 loc) · 2.96 KB
/
pre-release.yml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Pre-Release Actions
on:
workflow_dispatch:
inputs:
action:
description: 'What action to perform'
required: true
type: choice
options:
- change operator version
- generate CHANGELOG
new-operator-version:
description: 'When changing the version of the operator, this is the new version to move to (e.g. 1.8.0).'
type: string
required: false
pr-owner:
description: 'GitHub ID of the pull request owner'
type: string
required: true
workflow_call:
inputs:
action:
description: 'What action to perform'
required: true
type: string
new-operator-version:
description: 'When changing the version of the operator, this is the new version to move to (e.g. 1.8.0).'
type: string
required: false
pr-owner:
description: 'GitHub ID of the pull request owner'
type: string
required: true
run-name: "Pre-Release Action: ${{ inputs.action }}"
jobs:
version-change:
runs-on: ubuntu-latest
if: ${{ inputs.action == 'change operator version' && inputs.new-operator-version != '' }}
steps:
- uses: actions/checkout@v4
- name: Change version in the source files
run: |
VERSION=${{ inputs.new-operator-version }} make change-operator-version
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Change operator version to ${{ inputs.new-operator-version }}
title: Change operator version to ${{ inputs.new-operator-version }}
body: 'Automated changes by pre-release.yml GitHub action'
signoff: true
branch: change-operator-version-${{ inputs.new-operator-version }}
delete-branch: true
assignees: ${{ inputs.pr-owner }}
- name: Print out details of the PR opened
run: |
echo "Version Change Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY
changelog:
runs-on: ubuntu-latest
if: ${{ inputs.action == 'generate CHANGELOG' }}
steps:
- uses: actions/checkout@v4
- name: Save current version to env
run: |
echo $(make echo-versions | grep -e '^VERSION=' ) >> $GITHUB_ENV
- name: Generate changelog
run: |
make gen-changelog
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update CHANGELOG for version ${{ env.VERSION }}
title: Update CHANGELOG for version ${{ env.VERSION }}
body: 'Automated changes by pre-release.yml GitHub action'
signoff: true
branch: changelog-${{ inputs.new-operator-version }}
delete-branch: true
assignees: ${{ inputs.pr-owner }}
- name: Print out details of the PR opened
run: |
echo "Changelog Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY