-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check to fail CI if VERSION file has not changed since last relea…
…se (#9602)
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: version-file-bump | ||
description: "Ensure that the VERSION file has been bumped since the last release." | ||
outputs: | ||
result: | ||
value: ${{ steps.compare.outputs.result }} | ||
description: 'Result of the comparison' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Get latest release version | ||
id: get-latest-version | ||
shell: bash | ||
run: | | ||
untrimmed_ver=$( | ||
curl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
--request GET \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases/latest?draft=false&prerelease=false" \ | ||
| jq -r .name | ||
) | ||
latest_version="${untrimmed_ver:1}" | ||
echo "latest_version=${latest_version}" | tee -a "$GITHUB_OUTPUT" | ||
- name: Get current version | ||
id: get-current-version | ||
shell: bash | ||
run: | | ||
current_version=$(head -n1 ./VERSION) | ||
echo "current_version=${current_version}" | tee -a "$GITHUB_OUTPUT" | ||
- name: Compare semantic versions | ||
uses: smartcontractkit/chainlink-github-actions/[email protected] | ||
id: compare | ||
with: | ||
version1: ${{ steps.get-current-version.outputs.current_version }} | ||
operator: eq | ||
version2: ${{ steps.get-latest-version.outputs.latest_version }} | ||
- name: Fail if version not bumped | ||
# XXX: The reason we are not checking if the current is greater than the | ||
# latest release is to account for hot fixes which may have been branched | ||
# from a previous tag. | ||
shell: bash | ||
env: | ||
VERSION_NOT_BUMPED: ${{ steps.compare.outputs.result }} | ||
run: | | ||
if [[ "${VERSION_NOT_BUMPED:-}" = "true" ]]; then | ||
echo "Version file not bumped since last release. Please bump the ./VERSION file in the root of the repo and commit the change." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters