Skip to content

Commit

Permalink
Add release script and update readme (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders authored Nov 1, 2020
1 parent 24e4b11 commit 312b7fa
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X github.com/netflix/weep/version.Version={{.Version}} -X github.com/netflix/weep/version.Commit={{.CommitDate}} -X github.com/netflix/weep/version.Date={{.Date}}
- -s -w -extldflags "-static" -X github.com/netflix/weep/version.Version={{.Version}} -X github.com/netflix/weep/version.Commit={{.CommitDate}} -X github.com/netflix/weep/version.Date={{.Date}}
mod_timestamp: '{{ .CommitTimestamp }}'
hooks:
post:
- upx "{{ .Path }}"
# hooks:
# post:
# - upx "{{ .Path }}"
archives:
- replacements:
darwin: Darwin
Expand Down
52 changes: 33 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,33 +173,48 @@ AWS_PROFILE=role1 aws s3 ls

## Shell Completion

###Bash:
### Bash

$ source <(weep completion bash)
```bash
source <(weep completion bash)
```

#### To load completions for each session, execute once:
Linux:
$ weep completion bash > /etc/bash_completion.d/weep
MacOS:
$ weep completion bash > /usr/local/etc/bash_completion.d/weep
To load completions for each session, execute this command once:

```bash
# Linux:
weep completion bash > /etc/bash_completion.d/weep
# MacOS:
weep completion bash > /usr/local/etc/bash_completion.d/weep
```

###Zsh:
### Zsh
If shell completion is not already enabled in your environment you will need
to enable it. You can execute the following once:

$ echo "autoload -U compinit; compinit" >> ~/.zshrc
```bash
echo "autoload -U compinit; compinit" >> ~/.zshrc
```

#### To load completions for each session, execute once:
$ weep completion zsh > "${fpath[1]}/_weep"
To load completions for each session, execute this command once:

#### You will need to start a new shell for this setup to take effect.
```bash
weep completion zsh > "${fpath[1]}/_weep"
```

You will need to start a new shell for this setup to take effect.

###Fish:
### Fish

$ weep completion fish | source
```bash
weep completion fish | source
```

#### To load completions for each session, execute once:
$ weep completion fish > ~/.config/fish/completions/weep.fish
To load completions for each session, execute this command once:

```bash
weep completion fish > ~/.config/fish/completions/weep.fish
```

## Building

Expand Down Expand Up @@ -235,11 +250,10 @@ docker run -v ~</optional/path/to/your/mtls/certs>:</optional/path/to/your/mtls/
Weep uses [goreleaser](https://goreleaser.com/) in Github Actions for releases. Check their
[install docs](https://goreleaser.com/install/) if you would like to experiment with the release process locally.

To create a new release, create and push a tag containing the [semantic version](https://semver.org/):
To create a new release, create and push a tag using the release script (requires [svu](https://github.com/caarlos0/svu)):

```bash
git tag -am "v1.2.3" v1.2.3
git push origin v1.2.3
./scripts/release.sh
```

Goreleaser will automatically create a release on the [Releases page](https://github.com/Netflix/weep/releases).
40 changes: 40 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# Copyright 2020 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if ! command -v svu &> /dev/null
then
echo "Please install svu:"
echo "go get github.com/caarlos0/svu"
exit
fi

if [ "$1" = "minor" ]; then
NEXT_VERSION=$(svu minor)
else
NEXT_VERSION=$(svu patch)
fi

if [ ! "$(git branch --show-current)" = "master" ]; then
echo "Not on default branch, exiting"
exit 1
else
echo "Creating and pushing tag for $NEXT_VERSION"
fi

git pull origin master
git tag -am "$NEXT_VERSION" "$NEXT_VERSION"
git push origin "$NEXT_VERSION"

0 comments on commit 312b7fa

Please sign in to comment.