Skip to content
Prev Previous commit
Next Next commit
chore: Move release scripts to scripts/release folder
  • Loading branch information
mafredri committed Dec 12, 2022
commit 0f5883f6d36e7df5c4fcb50467857b78d9f7dbe7
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:

- name: Publish release
run: |
./scripts/publish_release.sh \
./scripts/release/publish.sh \
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
./build/*_installer.exe \
./build/*.zip \
Expand Down
6 changes: 3 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ mapfile -t versions < <(gh api -H "Accept: application/vnd.github+json" /repos/c
old_version=${versions[0]}

log "Checking commit metadata for changes since $old_version..."
# shellcheck source=scripts/check_commit_metadata.sh
source "$SCRIPT_DIR/check_commit_metadata.sh" "$old_version..$ref"
# shellcheck source=scripts/release/check_commit_metadata.sh
source "$SCRIPT_DIR/release/check_commit_metadata.sh" "$old_version..$ref"

mapfile -d . -t version_parts <<<"$old_version"
if [[ $minor == 1 ]] || [[ $COMMIT_METADATA_BREAKING == 1 ]]; then
Expand All @@ -93,7 +93,7 @@ new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
log "Old version: ${old_version}"
log "New version: ${new_version}"

release_notes="$(execrelative ./generate_release_notes.sh --old-version "$old_version" --new-version "$new_version" --ref "$ref")"
release_notes="$(execrelative ./release/generate_release_notes.sh --old-version "$old_version" --new-version "$new_version" --ref "$ref")"

echo
read -p "Preview release notes? (y/n) " -n 1 -r show_reply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"

range=${1:-}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"

old_version=
new_version=
Expand Down Expand Up @@ -58,8 +58,8 @@ if [[ -z $ref ]]; then
error "No ref specified"
fi

# shellcheck source=scripts/check_commit_metadata.sh
source "$SCRIPT_DIR/check_commit_metadata.sh" "${old_version}..${ref}"
# shellcheck source=scripts/release/check_commit_metadata.sh
source "$SCRIPT_DIR/release/check_commit_metadata.sh" "${old_version}..${ref}"

# Sort commits by title prefix, then by date, only return sha at the end.
mapfile -t commits < <(git log --no-merges --pretty=format:"%ct %h %s" "${old_version}..${ref}" | sort -k3,3 -k1,1n | cut -d' ' -f2)
Expand Down
8 changes: 4 additions & 4 deletions scripts/publish_release.sh → scripts/release/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pipeline to do the final publish step. If you want to create a release use:
# git tag -a -m "$ver" "$ver" && git push origin "$ver"
#
# Usage: ./publish_release.sh [--version 1.2.3] [--dry-run] path/to/asset1 path/to/asset2 ...
# Usage: ./publish.sh [--version 1.2.3] [--dry-run] path/to/asset1 path/to/asset2 ...
#
# The supplied images must already be pushed to the registry or this will fail.
# Also, the source images cannot be in a different registry than the target
Expand All @@ -27,7 +27,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"

if [[ "${CI:-}" == "" ]]; then
error "This script must be run in CI"
Expand Down Expand Up @@ -106,8 +106,8 @@ if [[ "$dry_run" == 1 ]]; then
new_ref="$(git rev-parse --short HEAD)"
fi

# shellcheck source=scripts/check_commit_metadata.sh
source "$SCRIPT_DIR/check_commit_metadata.sh" "$old_tag..$new_ref"
# shellcheck source=scripts/release/check_commit_metadata.sh
source "$SCRIPT_DIR/release/check_commit_metadata.sh" "$old_tag..$new_ref"

# Craft the release notes.
release_notes="$(execrelative ./generate_release_notes.sh --old-version "$old_tag" --new-version "$new_tag" --ref "$new_ref")"
Expand Down