Skip to content

Commit

Permalink
A release script
Browse files Browse the repository at this point in the history
  • Loading branch information
amireh committed Feb 23, 2015
1 parent 9adb705 commit 8dfaa85
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .env
@@ -0,0 +1,3 @@
GITHUB_USER="amireh"
GITHUB_REPO="lua_cliargs"
GITHUB_TOKEN=
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
/luacov.report.out
/luacov.stats.out
/luacov.stats.out
/.env.local
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -126,6 +126,14 @@ A function reference was generated using [LunaDoc](http://jgm.github.com/lunamar
## Changelog
Changes in 2.3.0
1. the parser will now understand `--` to denote the end of optional arguments and will map whatever comes after it to required/splat args
2. `-short VALUE` is now properly supported, so is `-short=VALUE`
3. short-key options can now officially be composed of more than 1 character
4. the parser now accepts callbacks that will be invoked as soon as options are parsed so that you can bail out of parsing preemptively (like for `--version` or `--help` options)
5. options can now accept multiple values via multiple invocations if a table was provided as a default value (passed-in values will be appended to that list)
Changes in 2.2-0 from 2.1-2
1. the `=` that separates keys from values in the `--expanded-key` notation is no longer mandatory; using either a space or a `=` will map the value to the key (e.g., `--compress lzma` is equal to `--compress=lzma`)
Expand Down
40 changes: 40 additions & 0 deletions bin/release
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

[ -f ".env" ] && source ".env"
[ -f ".env.local" ] && source ".env.local"

function abort {
echo -e "\e[00;31m[ FAILED ]\e[00m ${1}"
exit 1
}

[ -z "${GITHUB_TOKEN}" ] && abort "Missing GITHUB_TOKEN env variable."
[ -z "${GITHUB_USER}" ] && abort "Missing GITHUB_USER env variable."
[ -z "${GITHUB_REPO}" ] && abort "Missing GITHUB_REPO env variable."

VERSION=$(grep "version" lua_cliargs-*.rockspec | cut -d' ' -f3 | sed 's/"//g')

# Publish to GitHub
JSON_PAYLOAD=$(
printf '{
"tag_name": "v%s",
"target_commitish": "master",
"name": "v%s",
"body": "Release of version %s",
"draft": false,
"prerelease": false
}' $VERSION $VERSION $VERSION
)

echo $JSON_PAYLOAD
echo "Releasing version ${VERSION}..."

# the API will automatically create the tag for us, no need to do it manually!
curl \
--data "$JSON_PAYLOAD" \
-X POST \
-H "Content-Type: application/json; charset=utf-8" \
-H "Accept: application/json" \
"https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases?access_token=${GITHUB_TOKEN}"

echo -e "\e[00;32m[ SUCCESS ]\e[00m"
6 changes: 3 additions & 3 deletions lua_cliargs-2.2-0.rockspec → lua_cliargs-2.3-0.rockspec
@@ -1,8 +1,8 @@
package = "lua_cliargs"
version = "2.2-0"
version = "2.3-0"
source = {
url = "https://github.com/downloads/amireh/lua_cliargs/lua_cliargs-2.2.tar.gz",
dir = "lua_cliargs-2.2"
url = "https://github.com/downloads/amireh/lua_cliargs/lua_cliargs-2.3-0.tar.gz",
dir = "lua_cliargs-2.3-0"
}
description = {
summary = "A command-line argument parser.",
Expand Down
27 changes: 0 additions & 27 deletions tarballs/create_tarball.sh

This file was deleted.

0 comments on commit 8dfaa85

Please sign in to comment.