Check for new collector versions #537
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 for new collector versions | |
# Description: | |
# This workflow is responsible for checking for new versions of the collector. | |
on: | |
schedule: | |
# Run every 12th hour at minute 40 past. | |
- cron: "40 */12 * * *" | |
workflow_dispatch: | |
jobs: | |
collector_update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update Version | |
id: update | |
run: | | |
LATEST_VER=$(curl -L -qs -H 'Accept: application/vnd.github+json' https://api.github.com/repos/signalfx/splunk-otel-collector/releases/latest | jq -r .tag_name) | |
sed -i "s/appVersion:.*/appVersion: ${LATEST_VER##v}/" helm-charts/splunk-otel-collector/Chart.yaml | |
make render | |
echo "Latest version: ${LATEST_VER}" | |
echo "LATEST_VER=${LATEST_VER}" >> "$GITHUB_OUTPUT" | |
if [[ -n $(git status --short) ]];then | |
echo "NEED_UPDATE=1" >> "$GITHUB_OUTPUT" | |
else | |
echo "NEED_UPDATE=0" >> "$GITHUB_OUTPUT" | |
fi | |
- name: PR the new version | |
if: ${{ steps.update.outputs.NEED_UPDATE == 1 }} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Update collector version | |
title: Update collector version to ${{ steps.update.outputs.LATEST_VER }} | |
body: Use the new version of the collector | |
branch: "update-${{ steps.update.outputs.LATEST_VER }}" | |
base: main | |
delete-branch: true |