Skip to content

Commit

Permalink
Add first release
Browse files Browse the repository at this point in the history
- follow scheme 0.X.Y.Z
- record version identifier when bootstrapping
- install latest sdd release by default instead of latest master
- add Changelog
- fix #6
  • Loading branch information
pylipp committed Feb 6, 2020
1 parent 22d7db9 commit 6464df2
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 6 deletions.
16 changes: 16 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased
### Added
### Changed
### Deprecated
### Removed
### Fixed

## [v0.1.0.0] - 2020-02-06
First release.
### Added
- Changelog file and related tooling.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ You're looking for managing an app but it's not included in `sdd` yet? Here's ho
1. Add the new files, commit, and push.
1. Open a PR!

### Releasing

1. Update Changelog.
1. Run `./release VERSION`

## Python apps

Consider using [`pipx`](https://pipxproject.github.io/pipx/) for installing Python applications (in isolated environments).
14 changes: 13 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ if [[ ! "$PATH" == *"$prefix/bin"* ]]; then
fi

# Record installed version
latest_tag="$(git tag --list --sort -refname | grep -m1 -E 'v0.[0-9]+.[0-9]+.[0-9]+')"
[ $? -ne 0 ] && exit 1

head_sha="$(git rev-parse HEAD)"
if [[ "$(git rev-parse "$latest_tag")" != "$head_sha" ]]; then
# construct version identifier of form 'v0.X.Y.Z (+N @d34dc0ffee)'
nr_commits_since_latest_tag="$(git rev-list "$latest_tag".. --count)"
latest_tag="$latest_tag (+$nr_commits_since_latest_tag @$head_sha)"
fi

echo "$latest_tag" > "$prefix"/lib/sdd/version

SDD_APPS_DIR=${XDG_DATA_DIR:-$HOME/.local/share}/sdd/apps
mkdir -p "$SDD_APPS_DIR"
echo sdd="$(git rev-parse HEAD)" >> "$SDD_APPS_DIR"/installed
echo sdd="$head_sha" >> "$SDD_APPS_DIR"/installed
2 changes: 1 addition & 1 deletion lib/sdd/apps/user/sdd
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ sdd_uninstall() {
}

sdd_fetch_latest_version() {
_sha_of_github_master pylipp sdd
_tag_name_of_latest_github_release pylipp sdd
}
10 changes: 6 additions & 4 deletions lib/sdd/framework/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ END_OF_HELP_TEXT

utils_version() {
# Publish version of present sdd installation to stdout
if [ ! -e "$SDD_DATA_DIR"/apps/installed ]; then
printf 'Cannot find %s.\n' "$SDD_DATA_DIR"/apps/installed >&2
return 1;
local version_filepath
version_filepath="$FRAMEWORKDIR"/../version
if [ ! -e "$version_filepath" ]; then
printf 'Cannot find %s.\n' "$version_filepath" >&2
return 1
fi

tac "$SDD_DATA_DIR"/apps/installed | grep -m 1 '^sdd=' | cut -d '=' -f2
cat "$version_filepath"
}

_validate_apps() {
Expand Down
17 changes: 17 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

if [ $# -ne 1 ]; then
printf "Usage: %s VERSION\n" "$0" >&2
exit 1
fi

version="$1"
if ! echo "$version" | grep -m1 -E 'v0.[0-9]+.[0-9]+.[0-9]+' >/dev/null 2>&1; then
printf "Version '%s' not in format v0.X.Y.Z\n" "$version" >&2
exit 1
fi

set -e
git tag "$version"
git push --tags origin master
hub release create -m "$version" -m "$(awk -v RS='' "/\[$version\]/" Changelog.md | tail -n+2)" -e -o "$version"
3 changes: 3 additions & 0 deletions test/framework/bootstrap.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ teardown() {

run "$HOME/.local/bin/sdd"
[ "$status" -eq 0 ]

run grep '^v' <("$HOME/.local/bin/sdd" --version)
[ "$status" -eq 0 ]
}

@test "Custom sdd installation succeeds" {
Expand Down

0 comments on commit 6464df2

Please sign in to comment.