Skip to content

Commit

Permalink
add version diff check in version-file-bump action (#12494)
Browse files Browse the repository at this point in the history
  • Loading branch information
momentmaker authored Mar 19, 2024
1 parent ee06eb2 commit d08a3e8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .github/actions/version-file-bump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
outputs:
result:
value: ${{ steps.compare.outputs.result }}
description: 'Result of the comparison'
description: "Result of the comparison"
runs:
using: composite
steps:
Expand Down Expand Up @@ -37,15 +37,34 @@ runs:
version1: ${{ steps.get-current-version.outputs.current_version }}
operator: eq
version2: ${{ steps.get-latest-version.outputs.latest_version }}
# The follow two steps are temp until we migrate to use version from package.json as the source of truth
- name: Get package version
id: get-package-version
shell: bash
run: |
package_version=$(jq -r '.version' ./package.json)
echo "package_version=${package_version}" | tee -a "$GITHUB_OUTPUT"
- name: Diff versions
uses: smartcontractkit/chainlink-github-actions/semver-compare@c67a09566412d153ff7640d99f96b43aa03abc04 # v2.3.6
id: diff
with:
version1: ${{ steps.get-current-version.outputs.current_version }}
operator: eq
version2: ${{ steps.get-package-version.outputs.package_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 }}
VERSION_SAME: ${{ steps.diff.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
if [[ "${VERSION_SAME:-}" = "false" ]]; then
echo "The version in the VERSION file is not the same as the version in package.json file. Please fix by running `pnpm changeset version`."
exit 1
fi

0 comments on commit d08a3e8

Please sign in to comment.