Update Kafka Version Table #525
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: Update Kafka Version Table | |
on: | |
schedule: | |
- cron: '*/5 * * * *' | |
jobs: | |
update_security_md: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get Kafka versions | |
id: get_versions | |
run: | | |
versions=$(curl -s https://downloads.apache.org/kafka/ | grep -oP 'href="\K[^"]+' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+/' | sort -rV | sed 's/\/$//') | |
echo "::set-output name=versions::$versions" | |
- name: Generate version table | |
run: | | |
versions=${{ steps.get_versions.outputs.versions }} | |
echo "| Version | Supported |" > table.md | |
echo "| ------- | ------------ |" >> table.md | |
for version in $versions; do | |
if curl --output /dev/null --silent --head --fail "https://downloads.apache.org/kafka/$version/"; then | |
echo "| $version | :white_check_mark: |" >> table.md | |
else | |
echo "| $version | :x: |" >> table.md | |
fi | |
done | |
- name: Update SECURITY.md | |
run: | | |
table=$(<table.md) | |
awk -v table="$table" '/\| Version \| Supported/ {print; print table; next}1' SECURITY.md > SECURITY.md.new | |
mv SECURITY.md.new SECURITY.md | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add SECURITY.md | |
if ! git diff --staged --quiet; then | |
git commit -m "Update Kafka version table - GH Action Pipeline run" | |
git push | |
else | |
echo "No changes to commit. Exiting job as successful." | |
fi |