Check OpenCTI major dependencies releases #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check OpenCTI major dependencies releases | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 * *' # first day of month | |
jobs: | |
check-and-update-major-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 | |
yq eval -i ".sources.${dependency}.spec.versionFilter.pattern = \"*\"" .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-major-output.log | |
awk '/TARGETS/{flag=1;next}/ACTIONS/{flag=0}flag' $GITHUB_WORKSPACE/tmp-major-output.log > $GITHUB_WORKSPACE/clean-major-output.log | |
chmod +x .github/hack/prepare_body_pr.sh | |
$GITHUB_WORKSPACE/.github/hack/prepare_body_pr.sh $GITHUB_WORKSPACE/clean-major-output.log > $GITHUB_WORKSPACE/major-output.log | |
# show PR body | |
cat major-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@v6 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
add-paths: charts/opencti | |
token: ${{ secrets.PAT_GITHUB }} | |
commit-message: "fix: update major dependencies version" | |
signoff: false | |
branch: fix/upgrade-opencti-major-dependencies-${{ steps.date.outputs.date }} | |
delete-branch: true | |
title: '[opencti] upgrade major dependencies (${{ steps.date.outputs.date }})' | |
body-path: major-output.log | |
draft: true | |
labels: | | |
auto-pr-bump-version | |
- name: Create PR with changes | |
uses: peter-evans/create-pull-request@v6 | |
if: github.event_name == 'schedule' | |
with: | |
add-paths: charts/opencti | |
token: ${{ secrets.PAT_GITHUB }} | |
commit-message: "fix: update major dependencies version" | |
signoff: false | |
branch: fix/upgrade-opencti-major-dependencies-${{ steps.date.outputs.date }} | |
delete-branch: true | |
title: '[opencti] upgrade major dependencies (${{ steps.date.outputs.date }})' | |
body-path: major-output.log | |
labels: | | |
auto-pr-bump-version |