Merge pull request #2 from sobolevn/staging

v0.1.0 release
pull/9/head
Sobolev Nikita 9 years ago
commit 3550e2a9c3

@ -5,6 +5,7 @@ sudo: false
branches: branches:
only: only:
- master - master
- develop
install: install:
- make install-test - make install-test

@ -1,3 +1,10 @@
SHELL:=/usr/bin/env bash
PREFIX?="/usr"
#
# Building:
#
all: build all: build
git-secret: src/_utils/* src/commands/* src/main.sh git-secret: src/_utils/* src/commands/* src/main.sh
@ -9,6 +16,14 @@ clean:
build: git-secret build: git-secret
install: clean build
@chmod +x "./utils/install.sh"
@sudo "./utils/install.sh" "$(PREFIX)"
#
# Testing:
#
install-test: install-test:
git clone https://github.com/sstephenson/bats.git vendor/bats git clone https://github.com/sstephenson/bats.git vendor/bats
@ -19,15 +34,24 @@ test:
rm -rf temp; mkdir temp; cd temp; \ rm -rf temp; mkdir temp; cd temp; \
bats "../tests"; bats "../tests";
install-man: #
gem install ronn # Manuals:
#
install-ronn:
@if [ ! `gem list ronn -i` == "true" ]; then gem install ronn; fi
build-man: build-man:
@if [ ! `gem list ronn -i` == "true" ]; then make install-man; fi @make install-ronn
ronn --roff man/man1/*.ronn ronn --roff man/*/*.ronn
build-gh-pages: build-gh-pages:
@/usr/bin/env bash utils/gh-branch.sh @chmod +x "./utils/gh-branch.sh"
@"./utils/gh-branch.sh"
#
# Development:
#
install-hooks: install-hooks:
@# pre-commit: @# pre-commit:
@ -38,3 +62,16 @@ install-hooks:
@chmod +x "${PWD}/.git/hooks/post-commit" @chmod +x "${PWD}/.git/hooks/post-commit"
develop: clean build install-hooks develop: clean build install-hooks
#
# Packaging:
#
install-fpm:
@if [ ! `gem list fpm -i` == "true" ]; then gem install fpm; fi
build-deb: clean build
@make install-fpm
@chmod +x "./utils/build-deb.sh"
@"./utils/build-deb.sh"

@ -6,10 +6,14 @@
![git-secret terminal preview](https://raw.githubusercontent.com/sobolevn/git-secret/gh-pages/images/gitsecret_terminal.gif) ![git-secret terminal preview](https://raw.githubusercontent.com/sobolevn/git-secret/gh-pages/images/gitsecret_terminal.gif)
## Installation and Usage ## Usage
See the [git-secret site](https://sobolevn.github.io/git-secret/). See the [git-secret site](https://sobolevn.github.io/git-secret/).
## Installation
See the [installation section](https://sobolevn.github.io/git-secret/#installation).
## Status ## Status
This project is still under development. Current objectives: This project is still under development. Current objectives:
@ -17,15 +21,20 @@ This project is still under development. Current objectives:
- add `trust-model` parameter to `git-secret-hide` - add `trust-model` parameter to `git-secret-hide`
- autocomplete for `zsh` plugin - autocomplete for `zsh` plugin
- extra tests - extra tests
- precompiled distributions for `brew` and other package managers - precompiled distribution for `RPM`, add dependencies for `.deb` package
- create `CONTRIBUTING.md` with custom styleguide, refactor code due to styleguide - integrate [`shellcheck`](https://github.com/koalaman/shellcheck) for code style tests
- create `CONTRIBUTING.md` with development process explained
- сygwin support (?) - сygwin support (?)
- add `CHANGELOG.md` with semantic versioning
## Testing ## Testing
For testing this project uses [`bats`](1). You can install it by running `make install-test`. For testing this project uses [`bats`](https://github.com/sstephenson/bats). You can install it by running `make install-test`.
To run tests call: `make test`. It will download and install `bats` into `vandor/bats` if it's not installed yet. To run tests call: `make test`. It will download and install `bats` into `vendor/bats` if it's not installed yet.
## Changelog
### Version 0.1.0
[1]: https://github.com/sstephenson/bats - Initial release

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-SECRET\-HIDE" "1" "February 2016" "" "" .TH "GIT\-SECRET\-HIDE" "1" "March 2016" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-secret\-hide\fR \- encrypts all added files with the inner keyring\. \fBgit\-secret\-hide\fR \- encrypts all added files with the inner keyring\.
@ -15,7 +15,7 @@ git secret hide [\-c] [\-v]
.fi .fi
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
\fBgit\-secret\-hide\fR create an encrypted version for each file added by \fBgit\-secret\-add\fR command\. Now anyone one from the \fBgit\-secret\fR\'s keyring can decrypt these files using the their secret key\. \fBgit\-secret\-hide\fR create an encrypted version for each file added by \fBgit\-secret\-add\fR command\. Now anyone from the \fBgit\-secret\fR\'s keyring can decrypt these files using their secret key\.
. .
.P .P
It is possible to modify the names of the encrypted files by setting \fBSECRETS_EXTENSION\fR variable\. It is possible to modify the names of the encrypted files by setting \fBSECRETS_EXTENSION\fR variable\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-SECRET\-INIT" "1" "February 2016" "" "" .TH "GIT\-SECRET\-INIT" "1" "March 2016" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-secret\-init\fR \- initializes git\-secret repository\. \fBgit\-secret\-init\fR \- initializes git\-secret repository\.
@ -15,7 +15,7 @@ git secret init
.fi .fi
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
\fBgit\-secret\-init\fR should be runned inside a \fBgit\fR repo\. \fBgit\-secret\-init\fR is the first command to be runned, until the git\-secret repository is inited other commands are unavailable\. \fBgit\-secret\-init\fR should be run inside a \fBgit\fR repo\. \fBgit\-secret\-init\fR is the first command to be run, until the git\-secret repository is inited other commands are unavailable\.
. .
.SH "OPTIONS" .SH "OPTIONS"
. .

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-SECRET\-REVEAL" "1" "February 2016" "" "" .TH "GIT\-SECRET\-REVEAL" "1" "March 2016" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-secret\-reveal\fR \- decrypts all added files\. \fBgit\-secret\-reveal\fR \- decrypts all added files\.
@ -15,7 +15,7 @@ git secret reveal [\-d dir] [\-p password]
.fi .fi
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
\fBgit\-secret\-reveal\fR \- decrypts all the files in the \fB\.gitsecret/paths/mapping\.cfg\fR by running a \fBgpg \-\-decrypt\fR command\. It is important to have paired secret\-key for one of the public\-keys, which were used in the encryption\. \fBgit\-secret\-reveal\fR \- decrypts all the files in the \fB\.gitsecret/paths/mapping\.cfg\fR by running a \fBgpg \-\-decrypt\fR command\. It is important to have paired secret\-key with one of the public\-keys, which were used in the encryption\.
. .
.SH "OPTIONS" .SH "OPTIONS"
. .

@ -1,10 +1,10 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-SECRET\-TELL" "1" "February 2016" "" "" .TH "GIT\-SECRET\-TELL" "1" "March 2016" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-secret\-tell\fR \- adds a person, who can access a private data\. \fBgit\-secret\-tell\fR \- adds a person, who can access private data\.
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
. .
@ -15,10 +15,10 @@ git secret tell [\-m] [\-d dir] [email]
.fi .fi
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
\fBgit\-secret\-tell\fR receives an email address as an input, searches for the \fBgpg\fR\-key in the \fBgpg\fR\'s \fBhomedir\fR by this email, then import a person\'s public key into the \fBgit\-secret\fR\'s inner keychain\. Since this moment this person can encrypt new files with the keyring which contains his key\. But he cannot decrypt the old files, which were already encrypted without his key\. They should be reencrypted with the new keyring by someone, who has the unencrypted files\. \fBgit\-secret\-tell\fR receives an email address as an input, searches for the \fBgpg\fR\-key in the \fBgpg\fR\'s \fBhomedir\fR by this email, then imports a person\'s public key into the \fBgit\-secret\fR\'s inner keychain\. From this moment this person can encrypt new files with the keyring which contains their key\. But they cannot decrypt the old files, which were already encrypted without their key\. They should be reencrypted with the new keyring by someone, who has the unencrypted files\.
. .
.P .P
\fBDo not manually import secret key into \fBgit\-secret\fR\fR\. Anyway, it won\'t work with any of the secret\-keys imported\. \fBDo not manually import secret key into \fBgit\-secret\fR\fR\. Anyways, it won\'t work with any of the secret\-keys imported\.
. .
.SH "OPTIONS" .SH "OPTIONS"
. .

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-SECRET" "7" "February 2016" "" "" .TH "GIT\-SECRET" "7" "March 2016" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-secret\fR \fBgit\-secret\fR
@ -26,7 +26,7 @@ There\'s a known problem in server configuration and deploying, when you have to
These files are not version controlled\. Filenames change, locations change, passwords change from time to time, some new information appears, other is removed\. And you can not tell for sure which version of the configuration file was used with each commit\. These files are not version controlled\. Filenames change, locations change, passwords change from time to time, some new information appears, other is removed\. And you can not tell for sure which version of the configuration file was used with each commit\.
. .
.IP "2." 4 .IP "2." 4
When building the automated deploment system there will be one extra step: download and place these secret\-configuration files where they need to be\. So you have to maintain an extra secure server, where everything is stored\. When building the automated deployment system there will be one extra step: download and place these secret\-configuration files where they need to be\. So you have to maintain an extra secure server, where everything is stored\.
. .
.IP "" 0 .IP "" 0
. .
@ -41,7 +41,7 @@ When building the automated deploment system there will be one extra step: downl
.IP "" 0 .IP "" 0
. .
.SS "What is <code>git\-secret</code>?" .SS "What is <code>git\-secret</code>?"
\fBgit\-secret\fR is a bash tool to store your private data inside a \fBgit\fR repo\. How\'s that? Basically, it just encrypts, using \fBgpg\fR, the tracked files with the public keys of all the users that you trust\. So everyone of them can decrypt these files using only their personal secret key\. Why to deal with all these private\-public keys stuff? Well, to make it easier for everyone to manage access rights\. There are no passwords that change\. When someone is out \- just delete his public key, reencrypt the files, and he won\'t be able to decrypt secrets anymore\. \fBgit\-secret\fR is a bash tool to store your private data inside a \fBgit\fR repo\. How\'s that? Basically, it just encrypts, using \fBgpg\fR, the tracked files with the public keys of all the users that you trust\. So everyone of them can decrypt these files using only their personal secret key\. Why deal with all this private\-public keys stuff? Well, to make it easier for everyone to manage access rights\. There are no passwords that change\. When someone is out \- just delete his public key, reencrypt the files, and he won\'t be able to decrypt secrets anymore\.
. .
.SH "Installation" .SH "Installation"
. .
@ -60,12 +60,42 @@ gpg (GnuPG) 1\.4\.20
.IP "" 0 .IP "" 0
. .
.SS "Supported platforms" .SS "Supported platforms"
\fBgit secret\fR works with \fBMac OS X\fR >= 10\.9, \fBUbuntu\fR >= 14\.04 and \fBDebian\fR >= 8\.3 You can add you platform to this list, if all the tests passes for you\. \fBCygwin\fR support is planned\. \fBgit secret\fR works with \fBMac OS X\fR >= 10\.9, \fBUbuntu\fR >= 14\.04 and \fBDebian\fR >= 8\.3 You can add your platform to this list, if all the tests pass for you\. \fBCygwin\fR support is planned\.
. .
.SS "Installation process" .SS "Installation process"
There are several ways to install \fBgit\-secret\fR: There are several ways to install \fBgit\-secret\fR:
. .
.P .P
\fBBrew\fR
.
.IP "1." 4
Run \fBbrew install sobolevn/tap/git\-secret\fR
.
.IP "" 0
.
.P
\fB\fBantigen\fR plugin (or any other \fBoh\-my\-zsh\fR\-styled plugin\-systems)\fR
.
.IP "1." 4
Add line \fBantigen bundle sobolevn/git\-secret\fR to your \fB\.zshrc\fR
.
.IP "2." 4
Run \fBsource ~/\.zshrc\fR or reopen the terminal
.
.IP "" 0
.
.P
\fB\fBmake install\fR\fR
.
.IP "1." 4
Download the latest realease here \fIhttps://github\.com/sobolevn/git\-secret/releases\fR
.
.IP "2." 4
Unpack and run \fBmake install PREFIX="your/installation/path"\fR, note that this command may require \fBsudo\fR
.
.IP "" 0
.
.P
\fBThe hard way\fR \fBThe hard way\fR
. .
.IP "1." 4 .IP "1." 4
@ -80,18 +110,18 @@ Move \fBgit\-secret\fR file and \fBman/\fR folder somewhere inside your \fB$PATH
.IP "" 0 .IP "" 0
. .
.P .P
\fB\fBantigen\fR plugin (or any other \fBoh\-my\-zsh\fR\-styled plugin\-systems)\fR \fBLocal \fB\.deb\fR package\fR
. .
.IP "1." 4 .IP "1." 4
Add line \fBantigen bundle sobolevn/git\-secret\fR to your \fB\.zshrc\fR Download the latest realease here \fIhttps://github\.com/sobolevn/git\-secret/releases\fR
. .
.IP "2." 4 .IP "2." 4
Run \fBsource ~/\.zshrc\fR or reopen the terminal Unpack, and run \fBmake build\-deb\fR, it is possible to set the output folder with \fB$SCRIPT_BUILD_DIR\fR variable\.
. .
.IP "" 0 .IP "3." 4
Install the local \fB\.deb\fR package with \fBdpkp \-i git\-secret\-package\-name\.deb\fR, note that this command may require \fBsudo\fR and the package name will be different
. .
.P .IP "" 0
\fBbrew\fR and \fBfpm\fR support is planned\.
. .
.SH "Usage" .SH "Usage"
These steps cover the basic process of using \fBgit\-secret\fR: These steps cover the basic process of using \fBgit\-secret\fR:
@ -109,7 +139,7 @@ Add first user to the system by running \fBgit secret tell your@gpg\.email\-id\f
Now it\'s time to add files you wish to encrypt inside the \fBgit\-secret\fR repository\. It can be done by running \fBgit secret add <filenames\.\.\.>\fR command\. Make sure these files are ignored, otherwise \fBgit secret\fR won\'t allow you to add them, as these files will be stored unencrypted\. Now it\'s time to add files you wish to encrypt inside the \fBgit\-secret\fR repository\. It can be done by running \fBgit secret add <filenames\.\.\.>\fR command\. Make sure these files are ignored, otherwise \fBgit secret\fR won\'t allow you to add them, as these files will be stored unencrypted\.
. .
.IP "5." 4 .IP "5." 4
When done, run \fBgit secret hide\fR all files, which you have added by \fBgit secret add\fR command will be encrypted with added public\-keys by the \fBgit secret tell\fR command\. Now it is safe to commit your cahnges\. \fBBut\fR\. It\'s recommened to add \fBgit secret hide\fR command to your \fBpre\-commit\fR hook, so you won\'t miss any changes\. When done, run \fBgit secret hide\fR all files, which you have added by \fBgit secret add\fR command will be encrypted with added public\-keys by the \fBgit secret tell\fR command\. Now it is safe to commit your changes\. \fBBut\fR\. It\'s recommended to add \fBgit secret hide\fR command to your \fBpre\-commit\fR hook, so you won\'t miss any changes\.
. .
.IP "6." 4 .IP "6." 4
Now decrypt files with \fBgit secret reveal\fR command\. It will ask you for your password\. And you\'re done! Now decrypt files with \fBgit secret reveal\fR command\. It will ask you for your password\. And you\'re done!
@ -119,7 +149,7 @@ Now decrypt files with \fBgit secret reveal\fR command\. It will ask you for you
.SS "I want to add someone to the repository" .SS "I want to add someone to the repository"
. .
.IP "1." 4 .IP "1." 4
Get his \fBgpg\fR public\-key\. \fBYou won\'t need his secret key\.\fR Get his \fBgpg\fR public\-key\. \fBYou won\'t need their secret key\.\fR
. .
.IP "2." 4 .IP "2." 4
Import this key inside your \fBgpg\fR by running \fBgpg \-\-import KEY_NAME\fR Import this key inside your \fBgpg\fR by running \fBgpg \-\-import KEY_NAME\fR
@ -128,7 +158,7 @@ Import this key inside your \fBgpg\fR by running \fBgpg \-\-import KEY_NAME\fR
Now add this person to the \fBgit\-secret\fR by running \fBgit secret tell persons@email\.id\fR Now add this person to the \fBgit\-secret\fR by running \fBgit secret tell persons@email\.id\fR
. .
.IP "4." 4 .IP "4." 4
Reencypt the files, now he will be able to decrypt them with his secret key\. Reencypt the files, now they will be able to decrypt them with their secret key\.
. .
.IP "" 0 .IP "" 0
. .

@ -39,18 +39,31 @@ You can add your platform to this list, if all the tests pass for you.
There are several ways to install `git-secret`: There are several ways to install `git-secret`:
**The hard way** **Brew**
1. Clone the repository first: `git clone https://github.com/sobolevn/git-secret.git git-secret` 1. Run `brew install sobolevn/tap/git-secret`
2. Run `cd git-secret && make build`
3. Move `git-secret` file and `man/` folder somewhere inside your `$PATH`, or extend your `$PATH` to contain `git-secret` file and `man/` folder
**`antigen` plugin (or any other `oh-my-zsh`-styled plugin-systems)** **`antigen` plugin (or any other `oh-my-zsh`-styled plugin-systems)**
1. Add line `antigen bundle sobolevn/git-secret` to your `.zshrc` 1. Add line `antigen bundle sobolevn/git-secret` to your `.zshrc`
2. Run `source ~/.zshrc` or reopen the terminal 2. Run `source ~/.zshrc` or reopen the terminal
`brew` and `fpm` support is planned. **`make install`**
1. Download the latest realease [here](https://github.com/sobolevn/git-secret/releases)
2. Unpack and run `make install PREFIX="your/installation/path"`, note that this command may require `sudo`
**The hard way**
1. Clone the repository first: `git clone https://github.com/sobolevn/git-secret.git git-secret`
2. Run `cd git-secret && make build`
3. Move `git-secret` file and `man/` folder somewhere inside your `$PATH`, or extend your `$PATH` to contain `git-secret` file and `man/` folder
**Local `.deb` package**
1. Download the latest realease [here](https://github.com/sobolevn/git-secret/releases)
2. Unpack, and run `make build-deb`, it is possible to set the output folder with `$SCRIPT_BUILD_DIR` variable.
3. Install the local `.deb` package with `dpkp -i git-secret-package-name.deb`, note that this command may require `sudo` and the package name will be different
## Usage ## Usage
These steps cover the basic process of using `git-secret`: These steps cover the basic process of using `git-secret`:

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
GITSECRET_VERSION="0.1.0"
# Global variables: # Global variables:
WORKING_DIRECTORY="$PWD" WORKING_DIRECTORY="$PWD"

@ -32,10 +32,10 @@ function reveal {
fi fi
if [[ ! -z "$passphrase" ]]; then if [[ ! -z "$passphrase" ]]; then
base="$base --batch --yes --passphrase $passphrase" echo "$passphrase" | $base --batch --yes --no-tty --passphrase-fd 0 -o "$line" "$encrypted_filename"
fi else
$base -o "$line" "$encrypted_filename" $base -o "$line" "$encrypted_filename"
fi
counter=$((counter+1)) counter=$((counter+1))
done < "$SECRETS_DIR_PATHS_MAPPING" done < "$SECRETS_DIR_PATHS_MAPPING"

@ -29,19 +29,29 @@ function _incorrect_usage {
} }
function _init_script { function _show_version {
# checking for proper set-up: echo "$GITSECRET_VERSION"
_check_setup exit 0
}
function _init_script {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
_incorrect_usage "no input parameters provided." 126 _incorrect_usage "no input parameters provided." 126
fi fi
if [[ $1 == "--version" ]]; then
_show_version
fi
# checking for proper set-up:
_check_setup
# load dependencies: # load dependencies:
# for f in ${0%/*}/src/*/*; do [[ -f "$f" ]] && . "$f"; done # for f in ${0%/*}/src/*/*; do [[ -f "$f" ]] && . "$f"; done
# routing the input command: # routing the input command:
if [[ $(_function_exists "$1") == 0 ]] && [[ ! $1 == _* ]]; then if [[ $(_function_exists $1) == 0 ]] && [[ ! $1 == _* ]]; then
$1 "${@:2}" $1 "${@:2}"
else else
_incorrect_usage "command $1 not found." 126 _incorrect_usage "command $1 not found." 126

@ -23,3 +23,9 @@ function teardown {
run git secret notacommand run git secret notacommand
[ "$status" -eq 126 ] [ "$status" -eq 126 ]
} }
@test "run 'git secret --version'" {
run git secret --version
[ "$output" == "$GITSECRET_VERSION" ]
}

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e
# Initializing and settings:
READ_PEM=0644
EXEC_PEM=0755
SCRIPT_NAME="git-secret"
SCRIPT_DESCRIPTION="A bash-tool to store your private data inside a git repository."
SCRIPT_VERSION=$(bash ${PWD}/git-secret --version)
: ${SCRIPT_EPOCH:=0}
: ${SCRIPT_ITERATION:=1}
if [[ -z "$SCRIPT_BUILD_DIR" ]]; then
SCRIPT_BUILD_DIR="${HOME}/debbuild-${SCRIPT_NAME}"
fi
SCRIPT_DEST_DIR="${SCRIPT_BUILD_DIR}/installroot"
# Preparing the files
rm -rf "$SCRIPT_BUILD_DIR"
mkdir -p "$SCRIPT_DEST_DIR"
# Coping the files inside the build folder:
install -D -T -b -m "$EXEC_PEM" -T "git-secret" "${SCRIPT_DEST_DIR}/usr/bin/git-secret"
install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/usr/share/man/man1"
install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/usr/share/man/man7"
for file in man/man1/* ; do
if [[ "$file" == *.ronn ]]; then
continue
fi
install -D -T -b -m "$READ_PEM" -T "$file" "${SCRIPT_DEST_DIR}/usr/share/${file}"
done
install -D -T -b -m "$READ_PEM" -T "man/man7/git-secret.7" \
"${SCRIPT_DEST_DIR}/usr/share/man/man7/git-secret.7"
# Building .deb package:
cd "$SCRIPT_DEST_DIR" && fpm -s dir -t deb \
-a all \
-n "$SCRIPT_NAME" \
--epoch "$SCRIPT_EPOCH" \
--version "$SCRIPT_VERSION" \
--iteration "$SCRIPT_ITERATION" \
--description="$SCRIPT_DESCRIPTION" \
-C "$SCRIPT_DEST_DIR" \
.

@ -4,12 +4,13 @@ set -e
function update_gh_branch { function update_gh_branch {
local branch_name=$(git branch | grep '*' | sed 's/* //')
git checkout gh-pages git checkout gh-pages
make make
git add _posts git add _posts
git commit -m 'documentation update' git commit -m 'documentation update'
git checkout master git checkout "$branch_name"
} }
update_gh_branch update_gh_branch

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
# Credit goes to:
# https://github.com/sstephenson/bats/blob/master/install.sh
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
PREFIX="$1"
if [ -z "$PREFIX" ]; then
echo "usage: $0 <prefix>" >&2
exit 1
fi
SCRIPT_ROOT="$(dirname $(abs_dirname "$0"))"
mkdir -p "$PREFIX"/bin "$PREFIX"/share/man/man1 "$PREFIX"/share/man/man7
cp "$SCRIPT_ROOT"/git-secret "$PREFIX"/bin/git-secret
cp -R "$SCRIPT_ROOT"/man/man1/* "$PREFIX"/share/man/man1
cp "$SCRIPT_ROOT"/man/man7/git-secret.7 "$PREFIX"/share/man/man7/git-secret.7
echo "Installed git-secret to $PREFIX/bin/git-secret"

@ -4,7 +4,16 @@ set -e
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
if [[ $BRANCH_NAME == 'master' ]]; then if [[ "$BRANCH_NAME" == 'develop' ]]; then
# Build new web documentation: # Build new web documentation:
make build-gh-pages make build-gh-pages
fi fi
if [[ "$BRANCH_NAME" == 'staging' ]]; then
# create new release:
NEWEST_TAG=$(git describe --abbrev=0 --tags)
SCRIPT_VERSION=$(bash ${PWD}/git-secret --version)
if [[ "$NEWEST_TAG" != "v${SCRIPT_VERSION}" ]]; then
git tag -a "v${SCRIPT_VERSION}" -m "version $SCRIPT_VERSION"
fi
fi

@ -16,5 +16,6 @@ if [[ $BRANCH_NAME != '(no branch)' ]]; then
# Add new files: # Add new files:
git add man/man1/* git add man/man1/*
git add man/man7/*
fi fi
fi fi

Loading…
Cancel
Save