-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·41 lines (33 loc) · 956 Bytes
/
publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /usr/bin/env bash
function release() {
local type="$1"
local version="$2"
local release_name="$3"
yarn github-release "$type" \
--owner "$LOGIN" \
--repo cards-editor \
--tag "$version" \
--name "$release_name" \
--body "$DESCRIPTION" \
$prerelease \
-T "$TOKEN" \
dist/*"$VERSION"*
}
default_login='paullaffitte'
env_token=$(printenv GITHUB_OAUTH_TOKEN)
read -p "Github LOGIN [$default_login]: " LOGIN
read -p "Github OAuth TOKEN [$env_token]: " -r TOKEN
LOGIN=${LOGIN:-$default_login}
TOKEN=${TOKEN:-$env_token}
rm -f ./node_modules/.bin/semver
VERSION=$(semver)
default_version_name="v$VERSION"
read -p "Release name [$default_version_name]: " RELEASE_NAME
read -p "Description: " DESCRIPTION
read -p "It's a prerelease (y/N): " -n 1 -r && echo
RELEASE_NAME=${RELEASE_NAME:-$default_version_name}
yarn release
if [[ $REPLY =~ ^[Yy]$ ]]; then
prerelease='--prerelease=true'
fi
release upload "$VERSION" "$RELEASE_NAME"