Skip to content

Check For New Release #558

Check For New Release

Check For New Release #558

#
# Copyright 2022-Present Sonatype Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# For details of what checks are run for PRs please refer below
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Check For New Release
jobs:
read_published_release_version:
runs-on: ubuntu-latest
name: Read Publish Release Version
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Check published version
run: |
# extract latest published release version
VERSION_LATEST=$(curl -sI https://download.sonatype.com/clm/server/latest.tar.gz -w "%{redirect_url}" | tail -1 | sed 's/.*nexus-iq-server-\(.*\)-bundle.*/\1/')
if [ "x${VERSION_LATEST}" = "x" ]
then
echo "Failed to determine latest version.."
exit 1
fi
echo "VERSION_LATEST: $VERSION_LATEST"
VERSION_BUILT=`cat version-to-build.txt`
echo "VERSION_BUILT: $VERSION_BUILT"
if [ "$VERSION_LATEST" = "$VERSION_BUILT" ]
then
echo "No action required, installer $VERSION_BUILT is up to date."
else
echo "Stale version detected: $VERSION_BUILT. New Installer ($VERSION_LATEST) needs to be built and published."
# write new version to build to disk, commit with trigger tag, and push changes to git
#echo "$VERSION_LATEST" > version-to-build.txt
# Configure GIT with user info for pushing
#git config user.name ${{ env.ACTION_GITHUB_USERNAME }}
#git config user.email ${{ env.ACTION_GITHUB_EMAIL }}
#git commit version-to-build.txt -m "[skip ci] Automated update to build new version: $VERSION_LATEST"
#git tag "build_new_version_$VERSION_LATEST" -m "Tag to trigger automated build of new version: $VERSION_LATEST"
#git push && git push --tags
# exit with failure so we are notified a new release should be built
exit 1
fi
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '25 20 * * *'
workflow_dispatch:
env:
# Setting an environment variable with the value of a configuration variable, allows local builds using --env-file
ACTION_GITHUB_USERNAME: ${{ vars.ACTION_GITHUB_USERNAME }}
ACTION_GITHUB_EMAIL: ${{ vars.ACTION_GITHUB_EMAIL }}