forked from janus-idp/helm-backstage
-
Notifications
You must be signed in to change notification settings - Fork 30
executable file
·133 lines (111 loc) · 5.07 KB
/
bump-version.yaml
File metadata and controls
executable file
·133 lines (111 loc) · 5.07 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Bump
on:
issue_comment:
types: [created]
jobs:
chart-version:
name: Chart Version
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- name: Check for command
id: command
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const commentBody = context.payload.comment.body;
const commandPrefix = "/bump ";
let commandName = "";
let chartName = "";
let bumpLevel = "";
if (commentBody.startsWith(commandPrefix)) {
commandName = "bump";
const args = commentBody.slice(commandPrefix.length).trim().split(" ");
if (args.length > 0 && args[0]) {
chartName = args[0];
bumpLevel = args[1] || "patch";
console.log(`Chart Name: ${chartName}, Bump Level: ${bumpLevel}`);
console.log(`Args array: ${JSON.stringify(args)}`);
const fs = require('fs');
fs.appendFileSync(process.env.GITHUB_OUTPUT, `chart-name=${chartName}\n`);
fs.appendFileSync(process.env.GITHUB_OUTPUT, `bump-level=${bumpLevel}\n`);
fs.appendFileSync(process.env.GITHUB_OUTPUT, `command-name=${commandName}\n`);
} else {
commandName = "";
core.warning("No chart name provided. Format: /bump <chart-name> [level]");
}
}
- name: Add eyes reaction
if: steps.command.outputs.command-name == 'bump'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
comment-id: ${{ github.event.comment.id }}
reactions: eyes
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
if: steps.command.outputs.command-name == 'bump'
with:
python-version: 3.14
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
if: steps.command.outputs.command-name == 'bump'
with:
go-version: ^1
- name: Setup helm-docs
if: steps.command.outputs.command-name == 'bump'
run: go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
- name: Generate token
if: steps.command.outputs.command-name == 'bump'
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
with:
app_id: ${{ vars.RHDH_GITHUB_APP_ID }}
private_key: ${{ secrets.RHDH_GITHUB_APP_PRIVATE_KEY }}
- name: Checkout Repository
if: steps.command.outputs.command-name == 'bump'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Checkout Pull Request
if: steps.command.outputs.command-name == 'bump'
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Get version
if: steps.command.outputs.command-name == 'bump'
id: get_version
uses: mikefarah/yq@751d8ad57b84f1794661bc70c0afb92a22ad7b3c # v4.53.2
with:
cmd: yq ".version" charts/${{ steps.command.outputs.chart-name }}/Chart.yaml
- uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1
if: steps.command.outputs.command-name == 'bump'
id: semver
with:
current_version: ${{ steps.get_version.outputs.result }}
level: ${{ steps.command.outputs.bump-level }}
- name: Bump the version
if: steps.command.outputs.command-name == 'bump'
uses: mikefarah/yq@751d8ad57b84f1794661bc70c0afb92a22ad7b3c # v4.53.2
with:
cmd: yq -i '.version = "${{ steps.semver.outputs.new_version }}"' charts/${{ steps.command.outputs.chart-name }}/Chart.yaml
- name: Run pre-commit
if: steps.command.outputs.command-name == 'bump'
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
continue-on-error: true
- name: Setup Gitsign
if: steps.command.outputs.command-name == 'bump'
uses: chainguard-dev/actions/setup-gitsign@22e1462fe474a8f6719caa583d0b7ef145cd6344 # main
- name: Commit pre-commit changes
if: steps.command.outputs.command-name == 'bump'
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7
with:
commit_message: Bump ${{ steps.command.outputs.chart-name }} version to ${{ steps.semver.outputs.new_version }}
commit_options: "-s"
commit_user_name: RHDH Bot
commit_user_email: 146280956+rhdh-bot@users.noreply.github.com
commit_author: RHDH Bot <146280956+rhdh-bot@users.noreply.github.com >