-
-
Notifications
You must be signed in to change notification settings - Fork 4
50 lines (43 loc) · 1.68 KB
/
check_apachekafka_release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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