-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (31 loc) · 1.12 KB
/
check-update.yml
File metadata and controls
33 lines (31 loc) · 1.12 KB
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
name: Check for updates
on:
schedule:
- cron: "*/5 * * * *"
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- run: |
LOCAL_VER=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/NavyStack/nodebb-docker.git \
| tail --lines=1 \
| cut --delimiter='/' --fields=3)
RELEASE_VER=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/NodeBB/NodeBB.git \
| tail --lines=1 \
| cut --delimiter='/' --fields=3)
if [[ $RELEASE_VER != $LOCAL_VER ]]; then
echo "Local version: $LOCAL_VER"
echo "Latest upstream version: $RELEASE_VER"
echo "Updating to latest version..."
git tag ${RELEASE_VER}
git push origin ${RELEASE_VER}
else
echo "No updates available..."
fi