Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- `--report-junit <file>` flag as an alias of `--log-junit`, for naming parity with `--report-html` (#705)

### Changed
- The GitHub Action's `version` input now defaults to the version pinned at the action ref instead of `latest`, so pinning the action by SHA pins a visible bashunit version
- `install.sh` now verifies the release checksum by default (set `BASHUNIT_VERIFY_CHECKSUM=false` to opt out); it soft-skips with a warning when a checksum asset is unavailable unless verification was explicitly requested (#703)
- `--log-gha` annotations now include the failing test's `line` (`::error file=…,line=…`), so they pin to the exact line in a pull request's "Files changed" tab (#704)

Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ branding:

inputs:
version:
description: 'bashunit version to install (e.g. "0.37.0") or "latest".'
description: 'bashunit version to install (e.g. "0.37.0"). Defaults to the version pinned at this action ref. Pass "latest" to override.'
required: false
default: latest
default: '0.38.0'
directory:
description: 'Directory, relative to the workspace, where the bashunit binary is installed.'
required: false
Expand Down
15 changes: 14 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare -r EXIT_EXECUTION_ERROR=2
# Constants
GITHUB_REPO_PATH="TypedDevs/bashunit"
GITHUB_REPO_URL="https://github.com/${GITHUB_REPO_PATH}"
RELEASE_FILES=("bashunit" "install.sh" "package.json" "docs/package.json" "CHANGELOG.md")
RELEASE_FILES=("bashunit" "install.sh" "action.yml" "package.json" "docs/package.json" "CHANGELOG.md")

# Helper function for regex matching (Bash 3.0+ compatible)
function regex_match() {
Expand Down Expand Up @@ -509,6 +509,7 @@ function release::sandbox::run() {
# Run release steps in sandbox (cd already done in setup_git)
release::update_bashunit_version "$VERSION"
release::update_install_version "$VERSION"
release::update_action_version "$VERSION"
release::update_package_json_version "$VERSION"
release::update_changelog "$VERSION" "$CURRENT_VERSION"

Expand Down Expand Up @@ -631,6 +632,15 @@ function release::update_install_version() {
"LATEST_BASHUNIT_VERSION"
}

function release::update_action_version() {
local new_version=$1
release::update_file_pattern \
"action.yml" \
"default: '[0-9][^']*'" \
"default: '$new_version'" \
"action.yml default version"
}

function release::update_package_json_version() {
local new_version=$1
release::update_file_pattern \
Expand Down Expand Up @@ -1033,6 +1043,9 @@ function release::main() {
release::update_install_version "$VERSION"
release::state::record_step "update_install_version"

release::update_action_version "$VERSION"
release::state::record_step "update_action_version"

release::update_package_json_version "$VERSION"
release::state::record_step "update_package_json_version"

Expand Down
12 changes: 12 additions & 0 deletions tests/unit/fixtures/release/mock_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Install bashunit
inputs:
version:
description: 'bashunit version to install.'
required: false
default: '0.30.0'
directory:
required: false
default: lib
add-to-path:
required: false
default: 'true'
24 changes: 24 additions & 0 deletions tests/unit/release_update_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@ function test_update_install_version_changes_version_string() {
rm -rf "$temp_dir"
}

function test_update_action_version_changes_only_numeric_default() {
local temp_dir
temp_dir=$(mktemp -d)

cp "$FIXTURES_DIR/mock_action.yml" "$temp_dir/action.yml"

DRY_RUN=false
(
cd "$temp_dir" || return
release::update_action_version "0.31.0" 2>/dev/null
)

local result
result=$(cat "$temp_dir/action.yml")
# The version default is bumped...
assert_contains "default: '0.31.0'" "$result"
# ...but non-numeric defaults are left untouched.
assert_contains "default: lib" "$result"
assert_contains "default: 'true'" "$result"
assert_not_contains "default: '0.30.0'" "$result"

rm -rf "$temp_dir"
}

function test_update_package_json_version_changes_version_string() {
local temp_dir
temp_dir=$(mktemp -d)
Expand Down
Loading