Skip to content

Check for updates #39421

Check for updates

Check for updates #39421

Workflow file for this run

name: Check for updates
on:
schedule:
- cron: "*/5 * * * *"
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
actions: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
LOCAL_TAG=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/netvpc/nginx.git \
| tail --lines=1 \
| cut --delimiter='/' --fields=3)
RELEASE_TAG=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/nginx/nginx.git \
| tail --lines=1 \
| cut --delimiter='/' --fields=3)
LOCAL_VER=$(echo $LOCAL_TAG | sed -E 's/^v?//')
RELEASE_VER=$(echo $RELEASE_TAG | sed -E 's/^release-//; s/^v?//')
echo "Local version: $LOCAL_VER"
echo "Latest upstream version: v${RELEASE_VER}"
if [[ "$RELEASE_VER" != "$LOCAL_VER" ]]; then
echo "Updating to latest version..."
git tag v${RELEASE_VER}
git push origin v${RELEASE_VER}
gh workflow run docker-publish.yml --ref v${RELEASE_VER}
else
echo "No updates available..."
fi