Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add version diff check in version-file-bump action #12494

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading