-
Notifications
You must be signed in to change notification settings - Fork 5
143 lines (132 loc) · 4.04 KB
/
release-charts.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
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
134
135
136
137
138
139
140
141
142
143
name: Release charts
on:
push:
branches:
- master
paths:
- "charts/*/Chart.yaml"
permissions: {}
jobs:
prepare:
if: github.repository == 'Scalr/agent-helm'
runs-on: ubuntu-latest
strategy:
matrix:
directory: [agent-k8s, agent-docker]
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get chart version
id: chart_version
run: |
set -euo pipefail
chart_version="$(grep -Po "(?<=^version: ).+" charts/${{ matrix.directory }}/Chart.yaml)"
echo "version=${chart_version}" >> $GITHUB_OUTPUT
- name: Get changelog entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
path: charts/${{ matrix.directory }}/CHANGELOG.md
version: "v${{ steps.chart_version.outputs.version }}"
- name: Create release notes
run: |
set -euo pipefail
cat <<"EOF" > charts/${{ matrix.directory }}/RELEASE.md
${{ steps.changelog_reader.outputs.changes }}
EOF
- name: Upload RELEASE.md
uses: actions/upload-artifact@v4
with:
name: release-notes-${{ matrix.directory }}
path: charts/${{ matrix.directory }}/RELEASE.md
release:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
if: github.repository == 'Scalr/agent-helm'
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download agent-k8s RELEASE.md
uses: actions/download-artifact@v4
with:
name: release-notes-agent-k8s
path: charts/agent-k8s
- name: Download agent-docker RELEASE.md
uses: actions/download-artifact@v4
with:
name: release-notes-agent-docker
path: charts/agent-docker
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set-up Helm
uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true
CR_MAKE_RELEASE_LATEST: false
CR_RELEASE_NOTES_FILE: RELEASE.md
notify:
name: Notify About Agent Helm Release
needs: [prepare, release]
if: always()
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- name: Release Succeeded
if: ${{ needs.release.result == 'success' }}
uses: slackapi/[email protected]
with:
payload: |
{
"text": "The Agent Helm has been Released",
"attachments": [
{
"color": "36a64f",
"fields": [
{
"title": "Job URL",
"value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"short": false
}
]
}
]
}
- name: Release Failed
if: ${{ contains(needs.*.result, 'failure')}}
uses: slackapi/[email protected]
with:
payload: |
{
"text": "The Agent Helm Release has been Failed",
"attachments": [
{
"color": "b52c2a",
"fields": [
{
"title": "Job URL",
"value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"short": false
}
]
}
]
}