-
Notifications
You must be signed in to change notification settings - Fork 722
69 lines (58 loc) · 2.32 KB
/
auto-bump.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
name: Auto Chart Bump
on:
workflow_call:
inputs:
eventPayload:
description: "Payload data from upstream repository"
required: true
type: string
jobs:
process-event:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log Event Payload
run: |
echo "Payload: ${{ github.event.inputs.chart }}; ${{ github.event.inputs.branch }}"
- name: Parse JSON Payload
id: parse_payload
run: |
echo "CHART=${{ github.event.inputs.chart }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: make chart-bump
run: |
echo "make chart-bump package=${{ env.CHART }} branch=${{ env.BRANCH }}"
last_line=$(make chart-bump package="${{ env.CHART }}" branch="${{ env.BRANCH }}" | tail -n 1)
echo "new_version=$last_line" >> $GITHUB_ENV
echo "new_version (in make step): $last_line" # For debugging in this step
- name: Debug new_version (to bump)
run: |
echo "new_version (in echo step): ${{ env.new_version }}"
- name: Read App Secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/github/app-credentials appId | APP_ID ;
secret/data/github/repo/${{ github.repository }}/github/app-credentials privateKey | PRIVATE_KEY ;
- name: Create App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.PRIVATE_KEY }}
- name: Push Changes
run: |
git push origin "auto-bump-${{ env.CHART }}-${{ env.new_version }}"
- name: Create Pull Request
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh pr create --base ${{ env.BRANCH }} --head "auto-bump-${{ env.CHART }}-${{ env.new_version }}" --title "[${{ env.BRANCH }}] auto: ${{ env.CHART }} ${{ env.new_version }}" --body-file '.github/auto_bump_template.md'