forked from fluent/fluent-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 3.14 KB
/
release-tool.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Create Release Pull Request
on:
workflow_dispatch:
inputs:
version:
description: 'New version number (e.g., v2.2.0)'
required: true
jobs:
create-target-release-branch:
name: create target release branch
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Create release branch
run: |
git checkout -b release-${{ github.event.inputs.version }}
git push --set-upstream origin release-${{ github.event.inputs.version }}
create-work-release-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Create release branch
run: |
git checkout -b release-${{ github.event.inputs.version }}-work
git push --set-upstream origin release-${{ github.event.inputs.version }}-work
create-release-pr:
name: create release pr
runs-on: ubuntu-latest
needs: [create-target-release-branch, create-work-release-branch]
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: release-${{ github.event.inputs.version }}-work
- name: Set up Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Update version in manifests
run: |
sed -i 's/fluent-operator:latest/fluent-operator:${{ github.event.inputs.version }}/' manifests/setup/fluent-operator-deployment.yaml
sed -i 's/fluent-operator:latest/fluent-operator:${{ github.event.inputs.version }}/' manifests/setup/setup.yaml
- name: Update version in values.yaml
run: |
sed -i '/repository: "kubesphere\/fluent-operator"/!b;n;s/tag: "latest"/tag: "${{ github.event.inputs.version }}"/' charts/fluent-operator/values.yaml
- name: Update version
run: |
echo ${{ github.event.inputs.version }} > VERSION
- name: Commit & Push changes
run: |
git add manifests/setup/fluent-operator-deployment.yaml manifests/setup/setup.yaml charts/fluent-operator/values.yaml VERSION
git commit -m "Bump version to ${{ github.event.inputs.version }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "Release ${{ github.event.inputs.version }}"
body: |
This PR updates the version to ${{ github.event.inputs.version }} in the following files:
- manifests/setup/fluent-operator-deployment.yaml
- manifests/setup/setup.yaml
- charts/fluent-operator/values.yaml
- VERSION
Please review and merge to release the new version.
branch: release-${{ github.event.inputs.version }}-work
base: release-${{ github.event.inputs.version }}