Skip to content

Commit

Permalink
chore: add workflow to check updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ialejandro committed Aug 2, 2024
1 parent 3c1036f commit bd47218
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/auto-assign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
permissions:
issues: write
pull-requests: write

steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: ialejandro
numOfAssignee: 1
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: ialejandro
numOfAssignee: 1
69 changes: 69 additions & 0 deletions .github/workflows/check-changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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
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

0 comments on commit bd47218

Please sign in to comment.