-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (36 loc) · 1.43 KB
/
readme.yml
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
name: Update README
on:
push:
branches: [ "main" ]
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get versions
id: versions
run: |
echo "GRADLE_VERSION=$(grep distributionUrl gradle/wrapper/gradle-wrapper.properties | sed -E 's/.*\/gradle-([0-9]+\.[0-9]+(\.[0-9]+)?)-bin.*/\1/;s/.*-([0-9]+\.[0-9]+\.[0-9]+)\.zip/\1/')" >> $GITHUB_ENV
echo "KOTLIN_VERSION=$(grep 'kotlin = ' gradle/libs.versions.toml | grep -oP 'kotlin = "\K[^"]+')" >> $GITHUB_ENV
echo "PLUGIN_GRADLE_VERSION=$(grep 'plugin-gradle = ' gradle/libs.versions.toml | grep -oP 'plugin-gradle = "\K[^"]+')" >> $GITHUB_ENV
shell: bash
- name: Update README
run: |
cat README_TEMPLATE.md | envsubst > README.md
- name: Commit changes
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
if [[ -n "$(git diff --exit-code README.md)" ]]; then
git add README.md
git commit -m "Update README with latest versions [skip ci]"
else
echo "No changes in README.md. Skipping commit."
exit 0
fi
- name: Push changes
uses: ad-m/[email protected]
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}