-
Notifications
You must be signed in to change notification settings - Fork 9
66 lines (57 loc) · 2.61 KB
/
check-opencti-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
name: Check OpenCTI new releases
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # every day
jobs:
check-and-update-opencti:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest release
id: latest_release
run: |
latest_release=$(curl -s https://api.github.com/repos/opencti-platform/opencti/releases | jq -r '.[0].name' | cut -d' ' -f 2)
echo "latest_release=$latest_release" >> $GITHUB_OUTPUT
- name: Get current release
id: current_release
run: |
current_release=$(grep appVersion charts/opencti/Chart.yaml | awk '{ print $2 }')
echo "current_release=$current_release" >> $GITHUB_OUTPUT
- name: Check if release changed
id: check_changes
run: |
if [ -z ${{ steps.latest_release.outputs.latest_release }} ]; then
echo "release_changed=false" >> $GITHUB_OUTPUT
elif [ ${{ steps.latest_release.outputs.latest_release }} != ${{ steps.current_release.outputs.current_release }} ]; then
echo "release_changed=true" >> $GITHUB_OUTPUT
fi
- name: Set new Chat.yaml appVersion
if: steps.check_changes.outputs.release_changed == 'true'
run: |
sed -i "s/appVersion: .*/appVersion: ${{ steps.latest_release.outputs.latest_release }}/g" charts/opencti/Chart.yaml
- name: Update README.md Helm Chart
if: steps.check_changes.outputs.release_changed == 'true'
uses: losisin/helm-docs-github-action@v1
with:
chart-search-root: charts/opencti
- name: Create PR with changes
if: steps.check_changes.outputs.release_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT_GITHUB }}
commit-message: "fix: update OpenCTI version to ${{ steps.latest_release.outputs.latest_release }}"
signoff: false
branch: fix/upgrade-opencti-appversion-${{ steps.latest_release.outputs.latest_release }}
delete-branch: true
title: '[opencti] new release: ${{ steps.latest_release.outputs.latest_release }}'
body: |
OpenCTI version:
- :information_source: Current: `${{ steps.current_release.outputs.current_release }}`
- :up: Upgrade: `${{ steps.latest_release.outputs.latest_release }}`
Changelog: https://github.com/OpenCTI-Platform/opencti/releases/tag/${{ steps.latest_release.outputs.latest_release }}
labels: |
auto-pr-bump-version