Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Aug 29, 2017
1 parent e35bb4d commit 678aec3
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
.DS_Store
Desktop.ini
._*
Thumbs.db
*.tmp
*.bak
*.log
*.lock
logs
package-lock.json
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://github.com/koalaman/shellcheck/wiki/TravisCI
sudo: required

language: bash

services:
- docker

before_install:
- docker pull koalaman/shellcheck

script:
- docker run -v $(pwd):/scripts koalaman/shellcheck index.sh

matrix:
fast_finish: true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Federico Brigante <npm@bfred.it> (bfred.it)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# daily-version [![Build Status](https://travis-ci.org/bfred-it/daily-version.svg?branch=master)](https://travis-ci.org/bfred-it/daily-version)

> Get the current date formatted as a version. Automatically add the time if you already released a version today.
This command line tool can be used to version your nightly builds while still allowing hot patches to have their own version number.


## Install

```
$ npm install --save daily-version
```


## Usage

```sh
$ daily-version
17.8.29

$ daily-version
17.8.29.1451
```

For example, it can be used to set the version of a Web Extension in a Travis cronjob:

```yml
script:
- dot-json manifest.json version $(daily-version)
- webstore upload --auto-publish
```
## License
MIT © [Federico Brigante](http://twitter.com/bfred_it)
13 changes: 13 additions & 0 deletions index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash

mkdir -p ~/.version-store/

CURR=$(date -u +%y.%-m.%-d)
PREV=$(cat ~/.version-store/v 2>/dev/null || true)

if [[ $PREV =~ ^$CURR ]]; then
CURR=$(date -u +%y.%-m.%-d.%-H%M)
fi

echo "$CURR" > ~/.version-store/v
echo "$CURR"
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "daily-version",
"version": "0.0.0",
"description": "Get the current date formatted as a version. Automatically add the time if you already released a version today.",
"bin": "index.sh",
"license": "MIT",
"repository": "bfred-it/daily-version",
"author": "Federico Brigante <github@bfred.it> (bfred.it)",
"keywords": [],
"files": [
"index.sh"
],
"scripts": {
"test": "shellcheck index.sh"
}
}

0 comments on commit 678aec3

Please sign in to comment.