diff --git a/.github/workflows/update_collector.yaml b/.github/workflows/update_collector.yaml new file mode 100644 index 0000000000..02d20fc91b --- /dev/null +++ b/.github/workflows/update_collector.yaml @@ -0,0 +1,44 @@ +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: + + +env: + VALUES_YAML: helm-charts/splunk-otel-collector/values.yaml + LATEST_API: https://api.github.com/repos/signalfx/splunk-otel-collector/releases/latest + +jobs: + maybe_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 + git diff --exit-code + NEED_UPDATE=$? + echo "LATEST_VER=${LATEST_VER}" >> "$GITHUB_OUTPUT" + echo "NEED_UPDATE=${NEED_UPDATE}" >> "$GITHUB_OUTPUT" + - 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.swizzle_version.outputs.LATEST_VER }}" + base: main + delete-branch: true + modify-outputs: false