-
Notifications
You must be signed in to change notification settings - Fork 56
50 lines (43 loc) · 1.67 KB
/
inotify_version.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
45
46
47
48
49
50
name: Update Inotify Version
on:
push:
branches:
- docs
jobs:
update_version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Ensure inotify_version file exists
run: |
if [ ! -f "docs/inotify_version" ]; then
touch docs/inotify_version
fi
- name: Get latest Inotify version
id: get_latest_version
run: |
latest_version=$(curl -s https://api.github.com/repos/inotify-tools/inotify-tools/releases/latest | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/')
echo "::set-output name=latest_version::$latest_version"
- name: Read inotify_version content
id: read_inotify_version
run: |
current_version=$(cat docs/inotify_version)
echo "::set-output name=current_version::$current_version"
- name: Compare versions
id: compare_versions
run: |
if [ "${{ steps.read_inotify_version.outputs.current_version }}" = "${{ steps.get_latest_version.outputs.latest_version }}" ]; then
echo "::set-output name=push_required::false"
else
echo "::set-output name=push_required::true"
fi
- name: Commit and push changes
if: steps.compare_versions.outputs.push_required == 'true'
run: |
echo "${{ steps.get_latest_version.outputs.latest_version }}" > docs/inotify_version
git config --global user.email "github-actions@example.com"
git config --global user.name "GitHub Actions"
git add docs/inotify_version
git commit -m "Update Inotify version"
git push