-
Notifications
You must be signed in to change notification settings - Fork 8
85 lines (73 loc) · 3.12 KB
/
check-opencti-minor-dependencies.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
name: Check OpenCTI minor dependencies releases
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' # every monday
jobs:
check-and-update-minor-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare updatecli configuration
id: dependencies
run: |
# get name dependencies
dependencies=($(yq eval -o=json '.dependencies[] | .name' charts/opencti/Chart.yaml | xargs))
# replace version
for dependency in "${dependencies[@]}"; do
version="~$(yq eval -r ".dependencies[] | select(.name == \"${dependency}\") | .version" charts/opencti/Chart.yaml | cut -d'.' -f1)"
yq eval -i ".sources.${dependency}.spec.versionFilter.pattern = \"${version}\"" .github/updatecli/helm-dependencies.yaml
done
- name: Install updatecli
uses: updatecli/updatecli-action@v2
- name: Update dependencies
run: |
updatecli apply --config .github/updatecli/helm-dependencies.yaml --commit=false 2>&1 | tee > $GITHUB_WORKSPACE/tmp-minor-output.log
awk '/TARGETS/{flag=1;next}/ACTIONS/{flag=0}flag' $GITHUB_WORKSPACE/tmp-minor-output.log > $GITHUB_WORKSPACE/clean-minor-output.log
chmod +x .github/hack/prepare_body_pr.sh
$GITHUB_WORKSPACE/.github/hack/prepare_body_pr.sh $GITHUB_WORKSPACE/clean-minor-output.log > $GITHUB_WORKSPACE/minor-output.log
# show PR body
cat minor-output.log
shell: bash
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Update README.md Helm Chart
uses: losisin/helm-docs-github-action@v1
with:
chart-search-root: charts/opencti
- name: Get current date
id: date
run: |
echo "date=$(date -I)" >> $GITHUB_OUTPUT
- name: Create PR with changes (dry-run)
uses: peter-evans/create-pull-request@v7
if: github.event_name == 'workflow_dispatch'
with:
add-paths: charts/opencti
token: ${{ secrets.PAT_GITHUB }}
commit-message: "fix: update minor dependencies version"
signoff: false
branch: fix/upgrade-opencti-minor-dependencies-${{ steps.date.outputs.date }}
delete-branch: true
title: '[opencti] upgrade minor dependencies (${{ steps.date.outputs.date }})'
body-path: minor-output.log
draft: true
labels: |
auto-pr-bump-version
- name: Create PR with changes
uses: peter-evans/create-pull-request@v7
if: github.event_name == 'schedule'
with:
add-paths: charts/opencti
token: ${{ secrets.PAT_GITHUB }}
commit-message: "fix: update minor dependencies version"
signoff: false
branch: fix/upgrade-opencti-minor-dependencies-${{ steps.date.outputs.date }}
delete-branch: true
title: '[opencti] upgrade minor dependencies (${{ steps.date.outputs.date }})'
body-path: minor-output.log
labels: |
auto-pr-bump-version