diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2022-03-17 09:02:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-17 09:02:50 -0400 |
commit | ef56269168a23a872d48a2ee47307482ee95cf45 (patch) | |
tree | 9764fa0a08fb398553c57ba2a4ab1612e83cbcd4 /.github/scripts | |
parent | d482661bab9a542692fae7e1872f268ac7c4043b (diff) |
Don't publish nightlies if they are unchanged since the last nightly. (#12411)
This skips publishing nightlies if the last commit that modified
`packaging/version` is also the latest commit on the master branch _and_
the version listed in `packaging/version` ends in `-nightly`.
If both conditions are met, then there have been no changes since the
last nightly build, thus we don0t need to publish a new nightly build.
This check is limited to runs that occur as part of the `schedule`
trigger, to ensure that manually triggered builds can be still be done
without having to worry about changes.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x | .github/scripts/prepare-release-base.sh | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/.github/scripts/prepare-release-base.sh b/.github/scripts/prepare-release-base.sh index 9044772267..0b35473a0f 100755 --- a/.github/scripts/prepare-release-base.sh +++ b/.github/scripts/prepare-release-base.sh @@ -102,13 +102,20 @@ elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then LAST_TAG=$(git describe --abbrev=0 --tags) COMMITS_SINCE_RELEASE=$(git rev-list "${LAST_TAG}"..HEAD --count) NEW_VERSION="${LAST_TAG}-$((COMMITS_SINCE_RELEASE + 1))-nightly" - echo "${NEW_VERSION}" > packaging/version || exit 1 - echo "::set-output name=run::true" - echo "::set-output name=message::Update changelog and version for nightly build: ${NEW_VERSION}." - echo "::set-output name=ref::master" - echo "::set-output name=type::nightly" - echo "::set-output name=branch::master" - echo "::set-output name=version::nightly" + LAST_VERSION_COMMIT="$(git rev-list -1 HEAD packaging/version)" + HEAD_COMMIT="$(git rev-parse HEAD)" + if [ "${EVENT_NAME}" = 'schedule' ] && [ "${LAST_VERSION_COMMIT}" = "${HEAD_COMMIT}" ] && grep -qE '.*-nightly$' packaging/version; then + echo "::notice::No commits since last nightly build, not publishing a new nightly build." + echo "::set-output name=run::false" + else + echo "${NEW_VERSION}" > packaging/version || exit 1 + echo "::set-output name=run::true" + echo "::set-output name=message::Update changelog and version for nightly build: ${NEW_VERSION}." + echo "::set-output name=ref::master" + echo "::set-output name=type::nightly" + echo "::set-output name=branch::master" + echo "::set-output name=version::nightly" + fi elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then echo "::notice::Preparing a patch release build." check_version_format || exit 1 |