-
Notifications
You must be signed in to change notification settings - Fork 8
71 lines (62 loc) · 2.23 KB
/
release.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
name: Release charts
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Get chart verison
id: chart_version
run: |
echo "CHART_VERSION=$(cat opencti/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -1)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: tag_exists
run: |
TAG_EXISTS=true
if ! [ $(git tag -l "v${{ steps.chart_version.outputs.CHART_VERSION }}") ]; then
TAG_EXISTS=false
fi
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
- name: Tag release
id: tag_version
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: v
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Add repositories
run: |
helm dependency list opencti 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
- name: Create release
uses: ncipollo/release-action@v1
with:
body: ${{ steps.tag_version.outputs.changelog }}
generateReleaseNotes: true
name: ${{ steps.tag_version.outputs.new_tag }}
prerelease: ${{ contains(steps.chart_version.outputs.CHART_VERSION, '-') }}
tag: ${{ steps.tag_version.outputs.new_tag }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
branch: gh-pages
charts_dir: .
charts_url: https://devops-ia.github.io/helm-opencti
index_dir: .
linting: true
owner: devops-ia
repository: helm-opencti
target_dir: .
token: ${{ secrets.GITHUB_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'