-
Notifications
You must be signed in to change notification settings - Fork 17
108 lines (98 loc) · 4.16 KB
/
Copy pathhelm-chart-release.yaml
File metadata and controls
108 lines (98 loc) · 4.16 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
name: Release Helm Chart
on:
workflow_dispatch:
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_APP_KEY }}
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0
- name: Wait for container images build
run: |
while :; do
result=$(gh api repos/:owner/:repo/actions/workflows | jq -r '.workflows[] | select(.name=="Release container images") | .id' | xargs -I {} gh api repos/:owner/:repo/actions/workflows/{}/runs --jq '.workflow_runs | max_by(.run_number)')
status=$(echo "$result" | jq -r '.status')
conclusion=$(echo "$result" | jq -r '.conclusion')
if [[ "$status" == "completed" ]]; then
if [[ "$conclusion" == "success" ]]; then
echo "Release container images workflow completed successfully"
break
else
echo "Release container images workflow failed"
exit 1
fi
elif [[ "$status" == "in_progress" || "$status" == "queued" ]]; then
echo "Release container images workflow is still running"
sleep 60
else
echo "Release container images workflow returned unexpected status: $status"
exit 1
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
- name: Add dependencies
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Semantic Release
id: semantic-release
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
semantic_version: 19.0.5
branch: main
extra_plugins: |
semantic-release-helm3@2.9.3
- name: Run chart-releaser
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
charts_dir: helm
config: .github/configs/cr.yaml
skip_existing: false
- name: Update main changelog
if: steps.semantic-release.outputs.new_release_published == 'true'
run: |
releases=$(gh release list --limit 2 --json name)
latest_release_tag=$(echo "$releases" | jq -r '.[0].name')
previous_release_tag=$(echo "$releases" | jq -r '.[1].name')
clean_latest_version=$(echo $latest_release_tag | sed -E 's/v//g')
echo "#### ${clean_latest_version}: Release" >> CHANGELOG.new
echo >> CHANGELOG.new
PR_IDS=$(git log ${previous_release_tag}..${latest_release_tag} --pretty=format:%s | grep -oE '\(#[0-9]+\)$' | sed -E 's/\(#([0-9]+)\)/\1/')
for PR_ID in $PR_IDS
do
echo " - "$(gh pr view $PR_ID --json title,number,author -t "{{.title}} (#{{.number}}) @{{.author.login}}") >> CHANGELOG.new
done
echo >> CHANGELOG.new
if [ -e CHANGELOG.md ]
then
cat CHANGELOG.md >> CHANGELOG.new
fi
mv CHANGELOG.new CHANGELOG.md
git config --global user.name "GitHub Actions Bot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "Update CHANGELOG for $clean_latest_version [no ci]"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}