update
This commit is contained in:
parent
042e9a7546
commit
65713ca5ac
1 changed files with 21 additions and 4 deletions
|
@ -30,25 +30,42 @@ jobs:
|
|||
apk add --no-cache git nodejs npm bash sed $PACKAGE
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest package version
|
||||
id: check
|
||||
run: |
|
||||
LATEST=$(apk policy "$PACKAGE" | awk '/^[[:space:]]*[0-9]/ { gsub(":", "", $1); print $1; exit }')
|
||||
echo "LATEST_VERSION=$LATEST" >> $GITHUB_ENV
|
||||
|
||||
main_version=$(curl -s https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz \
|
||||
| tar -xzO \
|
||||
| grep -a -oP 'cmd:rsync=\K\S+' | sort -V | tail -n 1)
|
||||
|
||||
community_version=$(curl -s https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz \
|
||||
| tar -xzO \
|
||||
| grep -a -oP 'cmd:rsync=\K\S+' | sort -V | tail -n 1)
|
||||
|
||||
testing_version=$(curl -s https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz \
|
||||
| tar -xzO \
|
||||
| grep -a -oP 'cmd:rsync=\K\S+' | sort -V | tail -n 1)
|
||||
|
||||
newest_version=$(echo -e "$main_version\n$community_version\n$testing_version" | sort -V | tail -n 1)
|
||||
|
||||
echo "newest_version" >> $GITHUB_ENV
|
||||
|
||||
- name: Determine if update is needed
|
||||
run: |
|
||||
last_version_file=".last_version"
|
||||
last_rebuild_file=".last_rebuild"
|
||||
last_dockerfile_hash_file=".dockerfile_hash"
|
||||
|
||||
last_version=$(cat $last_version_file 2>/dev/null || echo "none")
|
||||
last_rebuild=$(cat $last_rebuild_file 2>/dev/null || echo 0)
|
||||
last_dockerfile_hash=$(cat $last_dockerfile_hash_fiole 2>/dev/null || echo "none")
|
||||
dockerfile_hash=$(sha256sum Dockerfile 2>/dev/null || echo "nuh")
|
||||
current_day=$(( $(date +%s) / 86400 ))
|
||||
|
||||
update="false"
|
||||
if [ "$last_version" != "$LATEST_VERSION" ] || [ $((current_day - last_rebuild)) -gt 3 ]; then
|
||||
if [ "$last_version" != "$LATEST_VERSION" ] || ["$last_dockerfile_hash" != "$dockerfile_hash"] || [ $((current_day - last_rebuild)) -gt 3 ]; then
|
||||
update="true"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue