diff options
author | Robin Krahl <me@robin-krahl.de> | 2016-02-21 01:01:34 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2016-02-21 01:01:34 +0100 |
commit | 3b5a208fa523f17039f55b9838ea9ad4a923811a (patch) | |
tree | c1643459868a0a41597d2d88d941061a0663031c /scripts | |
parent | e6db8d7cb75b1a126acf050ab27d91ffe5e18ae5 (diff) | |
download | LrMediaWiki-master.tar.gz LrMediaWiki-master.tar.bz2 |
Add the release.sh script that prepares and publishes a release of
LrMediaWiki. The script assumes that the corresponding release has
already been created on GitHub. It bundles the required files, creates
archives and checksums and uploads them to GitHub.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/release.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..e60890c --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,61 @@ +#! /bin/bash +# Copyright (C) 2016 Robin Krahl <robin.krahl@wikipedia.de> +# +# This script bundles LrMediaWiki and uploads the bundled plugin to GitHub. +# You have to pass the version number (e. g. 1.0). The script will upload the +# bundled plugin to the release with the tag v<VERSION>, e. g. v1.0. This +# script requires that the environment variable GITHUB_TOKEN is set to a valid +# token for the repository to release a version for. +# +# Dependencies: +# - github-release: https://github.com/aktau/github-release + +if [[ "$#" -ne 1 ]] +then + echo "USAGE: ./release.sh <version>" + echo " version: the semantic version name, e. g. 1.0" + + if [[ "$#" -gt 1 ]] + then + echo "1 argument required, $# given" >&2 + exit 1 + else + exit 0 + fi +fi + +# user input +VERSION="$1" +# github-release settings +GITHUB_USER="robinkrahl" +GITHUB_REPO="LrMediaWiki" +# paths and file names +TMPDIR=`mktemp -d` +LRDEVPLUGIN="mediawiki.lrdevplugin" +LRPLUGIN="mediawiki.lrplugin" +TAG="v$1" +ARCHIVE_BASE_NAME="lrmediawiki-$VERSION" +ARCHIVE_NAME_ZIP="$ARCHIVE_BASE_NAME.zip" +ARCHIVE_NAME_TAR_GZ="$ARCHIVE_BASE_NAME.tar.gz" +CHECKSUM_NAME="checksums.md5" + +# copy required files to the temporary direction +cp -r "$LRDEVPLUGIN" "$TMPDIR/$LRPLUGIN" +cp *.md *.txt "$TMPDIR/$LRPLUGIN" + +cd $TMPDIR + +# create archives +zip -r "$ARCHIVE_NAME_ZIP" "$LRPLUGIN" +tar -czf "$ARCHIVE_NAME_TAR_GZ" "$LRPLUGIN" +# create checksums +md5sum "$ARCHIVE_NAME_ZIP" "$ARCHIVE_NAME_TAR_GZ" > "$CHECKSUM_NAME" + +# upload +for FILE in "$ARCHIVE_NAME_ZIP" "$ARCHIVE_NAME_TAR_GZ" "$CHECKSUM_NAME" +do + github-release upload --tag "$TAG" --name "$FILE" --file "$FILE" --user "$GITHUB_USER" --repo "$GITHUB_REPO" +done + +rm -r "$TMPDIR" +echo "DONE" |