-
Notifications
You must be signed in to change notification settings - Fork 23
81 lines (70 loc) · 2.42 KB
/
release.yml
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
name: Release Charts on Merge
on:
pull_request:
types: [closed]
branches:
- main
jobs:
release-on-merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Installer jq
run: sudo apt-get install jq
- name: Check 'release' Label
id: check_release_label
run: |
labels='${{ toJSON(github.event.pull_request.labels) }}'
echo "Labels de la PR : $labels"
if echo "$labels" | jq -e '.[] | select(.name=="release")' > /dev/null; then
echo "has_release_label=true" >> $GITHUB_ENV
else
echo "has_release_label=false" >> $GITHUB_ENV
fi
- name: Lint Chart - Main chart
if: env.has_release_label == 'true'
run: helm lint .
- name: Update Dependencies
if: env.has_release_label == 'true'
run: helm dependency update .
- name: Deploy to GitHub Pages
if: env.has_release_label == 'true'
run: |
git checkout gh-pages
git pull origin gh-pages --rebase
helm package . --destination charts/
helm repo index . --url https://getlago.github.io/charts
git add .
git commit -m "Update Helm repo index after release"
git push origin gh-pages
- name: Extract version from Chart.yaml
if: env.has_release_label == 'true'
id: get_version
run: |
version=$(grep '^version:' Chart.yaml | awk '{print $2}')
echo "Extracted version: $version"
echo "version=$version" >> $GITHUB_ENV
- name: Create Git tag
if: env.has_release_label == 'true'
run: |
git tag "v${{ env.version }}"
git push origin "v${{ env.version }}"
- name: Create GitHub Release
if: env.has_release_label == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.version }}"
release_name: "Release v${{ env.version }}"
body: "Release of version v${{ env.version }}"
draft: false
prerelease: false