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

added get_latest_tag in install.sh #248

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
This is a guide to know the steps to create a new release.

1. Update the version in [BASHUNIT_VERSION](../bashunit)
2. Update the version in [LATEST_BASHUNIT_VERSION](../install.sh)
3. Update the version in [CHANGELOG.md](../CHANGELOG.md)
4. Update the version in [package.json](../package.json)
5. Create a [new release](https://github.com/TypedDevs/bashunit/releases/new) from GitHub
6. Attach the latest executable to the release
2. Update the version in [CHANGELOG.md](../CHANGELOG.md)
3. Update the version in [package.json](../package.json)
4. Create a [new release](https://github.com/TypedDevs/bashunit/releases/new) from GitHub
5. Attach the latest executable to the release
1. Generate a new bashunit with `build.sh`
2. Attach the generated file to the release page on GitHub
3. Keep the name `bashunit`
7. Commit and push
8. Rebase `latest` branch from the new created tag and push
6. Commit and push
7. Rebase `latest` branch from the new created tag and push
1. This will trigger "build and deploy" the docs
12 changes: 11 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

# shellcheck disable=SC2164
# shellcheck disable=SC2103
declare -r BASHUNIT_GIT_REPO="https://github.com/TypedDevs/bashunit"

function get_latest_tag() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write a test to ensure the behaviour of this new function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the existing function for the latest update;
A test case already exists to test the function test_get_latest_tag() in \bashunit\tests\unit\helpers_test.sh.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For acceptance tests,
we have a function called test_install_downloads_the_latest_version() in tests\acceptance\install_test.sh, which does the same, and it passed when I tested locally after changes.

Please let me know if you want something else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, that test is covering that area as well, thanks!

git ls-remote --tags "$BASHUNIT_GIT_REPO" |
awk '{print $2}' |
sed 's|^refs/tags/||' |
sort -Vr |
head -n 1
}

declare -r LATEST_BASHUNIT_VERSION="0.11.0"
declare -r LATEST_BASHUNIT_VERSION="$(get_latest_tag)"

DIR=${1-lib}
VERSION=${2-latest}
TAG="$LATEST_BASHUNIT_VERSION"


function build_and_install_beta() {
echo "> Downloading non-stable version: 'beta'"
git clone --depth 1 --no-tags https://github.com/TypedDevs/bashunit temp_bashunit 2>/dev/null
Expand Down