-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce version increment validation |
main
(#51)
* Verify the version bump against the base branch (#45) * Add patch (#49) * Add second patch * π Release `observability@0.2.1 β 0.2.2` (#50) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Add patch * π Release `observability@0.2.29 β 0.2.30` (#51) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Use publihsedPackages for tagged_release * Reset source changes * Add comments about fetch-depth: 0 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0cd6f20
commit 2a5ba95
Showing
2 changed files
with
112 additions
and
39 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,64 @@ | ||
name: Read changeset status | ||
|
||
inputs: | ||
args: | ||
description: Additional arguments to pass to 'yarn changeset status' | ||
required: false | ||
|
||
outputs: | ||
base_branch: | ||
description: The base branch of the changeset | ||
value: ${{ steps.status.outputs.base_branch }} | ||
name: | ||
description: The name of the package | ||
value: ${{ steps.status.outputs.name }} | ||
type: | ||
description: "The type of version bump: 'patch' | 'minor' | 'major'" | ||
value: ${{ steps.status.outputs.type }} | ||
old_version: | ||
description: The old version of the package | ||
value: ${{ steps.status.outputs.old_version }} | ||
new_version: | ||
description: The new version of the package | ||
value: ${{ steps.status.outputs.new_version }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Read Changeset Status | ||
shell: bash | ||
id: status | ||
run: | | ||
OUTPUT=$(mktemp "${{runner.temp}}/changeset-output.XXXXXX.json") | ||
if [ ! -f "$OUTPUT" ]; then | ||
echo "π¨ Error: Failed to create temp file at: $OUTPUT" | ||
exit 1 | ||
fi | ||
echo "β Temporary file created at: $OUTPUT" | ||
# Run the changeset status command with relative path output | ||
yarn changeset status ${{ inputs.args }} --output $(realpath --relative-to . "$OUTPUT") | ||
if [ ! -s "$OUTPUT" ]; then | ||
echo "π¨ Error: Temporary file is empty after running 'yarn changeset status'" | ||
exit 1 | ||
fi | ||
# if the .releases length is greater than 0, then the changeset is ready to be released | ||
if jq -e '.releases | length > 0' "$OUTPUT" > /dev/null; then | ||
NAME=$(jq -r '.releases[0].name' "$OUTPUT") | ||
TYPE=$(jq -r '.releases[0].type' "$OUTPUT") | ||
OLD_VERSION=$(jq -r '.releases[0].oldVersion' "$OUTPUT") | ||
NEW_VERSION=$(jq -r '.releases[0].newVersion' "$OUTPUT") | ||
echo "name=$NAME" >> $GITHUB_OUTPUT | ||
echo "type=$TYPE" >> $GITHUB_OUTPUT | ||
echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT | ||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
else | ||
echo "β© No changeset found" | ||
fi | ||
BASE_BRANCH=$(jq -r '.baseBranch' .changeset/config.json) | ||
echo "base_branch=$BASE_BRANCH" >> $GITHUB_OUTPUT |
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