Skip to content

Check OpenCTI new releases #59

Check OpenCTI new releases

Check OpenCTI new releases #59

name: Check OpenCTI updates
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
check-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest version
id: latest_version
run: |
# latest
latest_version=$(curl -s https://api.github.com/repos/opencti-platform/opencti/tags | jq -r '.[0].name')
echo "latest_version=$latest_version" >> $GITHUB_OUTPUT
- name: Get current appVersion
id: current_version
run: |
# current
current_version=$(grep appVersion opencti/Chart.yaml | awk '{ print $2 }')
echo "current_version=$current_version" >> $GITHUB_OUTPUT
- name: Check if exists changes
id: check_changes
run: |
# check changes
if [ ${{ steps.latest_version.outputs.latest_version }} != ${{ steps.current_version.outputs.current_version }} ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
- name: Update appVersion
if: steps.check_changes.outputs.version_changed == 'true'
run: |
# update appVersion
sed -i "s/appVersion: .*/appVersion: ${{ steps.latest_version.outputs.latest_version }}/g" opencti/Chart.yaml
- name: Update helm chart README.md
if: steps.check_changes.outputs.version_changed == 'true'
uses: losisin/helm-docs-github-action@v1
with:
chart-search-root: opencti
- name: Create Pull Request
if: steps.check_changes.outputs.version_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHB_PERSONAL_TOKEN }}
commit-message: "fix: bump OpenCTI version to ${{ steps.latest_version.outputs.latest_version }}"
signoff: true
branch: fix/upgrade-opencti-appversion-${{ steps.latest_version.outputs.latest_version }}
delete-branch: true
title: '[opencti] Bump version to ${{ steps.latest_version.outputs.latest_version }}'
body: |
Bump OpenCTI version:
- :information_source: Current: `${{ steps.current_version.outputs.current_version }}`
- :up: Upgrade: `${{ steps.latest_version.outputs.latest_version }}`
Changelog: https://github.com/OpenCTI-Platform/opencti/releases/tag/${{ steps.latest_version.outputs.latest_version }}
labels: |
auto-pr-bump-version
assignees: ialejandro
reviewers: ialejandro