chore: remove standart-version, add scripts

This commit is contained in:
alxshelepenok 2019-07-19 21:09:54 +03:00
parent d5d6b2bf50
commit 0d1a62d655
4 changed files with 1370 additions and 1821 deletions

View File

@ -15,8 +15,7 @@
"lint": "concurrently \"yarn run lint:js\" \"yarn run lint:scss\" \"yarn flow\"", "lint": "concurrently \"yarn run lint:js\" \"yarn run lint:scss\" \"yarn flow\"",
"test": "jest --config ./jest/jest-config.js", "test": "jest --config ./jest/jest-config.js",
"test:coverage": "jest --coverage --config ./jest/jest-config.js", "test:coverage": "jest --coverage --config ./jest/jest-config.js",
"test:watch": "jest --watch --config ./jest/jest-config.js", "test:watch": "jest --watch --config ./jest/jest-config.js"
"release": "standard-version"
}, },
"repository": "https://github.com/alxshelepenok/gatsby-starter-lumen", "repository": "https://github.com/alxshelepenok/gatsby-starter-lumen",
"author": "Alexander Shelepenok <alxshelepenok@gmail.com>", "author": "Alexander Shelepenok <alxshelepenok@gmail.com>",
@ -113,7 +112,6 @@
"postcss-pxtorem": "4.0.1", "postcss-pxtorem": "4.0.1",
"react-test-renderer": "16.8.6", "react-test-renderer": "16.8.6",
"rimraf": "2.6.3", "rimraf": "2.6.3",
"standard-version": "6.0.1",
"stylelint": "10.1.0", "stylelint": "10.1.0",
"stylelint-config-recommended-scss": "3.3.0", "stylelint-config-recommended-scss": "3.3.0",
"stylelint-scss": "3.9.1" "stylelint-scss": "3.9.1"

View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
usage() {
echo "$0 <tag> <repo>" >&2;
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 1;
fi
if [ -z "$2" ]
then
REPO=$(git ls-remote --get-url origin | \
sed -u 's/git@//g; s/https:\/\///g; s/github.com\///g; s/\.git//g')
else
REPO=$2
fi
NEW_TAG=$1
CURRENT_DATE=$(date +"%Y-%m-%d")
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
LAST_DATE=$(git log -1 --format=%ai $LAST_TAG)
CHANGES=$(curl -s "https://api.github.com/repos/${REPO}/pulls?state=closed" | \
jq --arg l "$LAST_DATE" -r '.[] | select((.merged_at != null) and (.closed_at > $l)) | "- [Pull #\(.number)](\(.html_url)): \(.title)"')
sed -i "4i ## [$NEW_TAG] - $CURRENT_DATE\n### Added\n${CHANGES//$'\n'/\\$'\n'}\n" CHANGELOG.md

View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e
usage() {
echo "$0 <repo> <tag> [<release name>]" >&2;
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 1;
fi
if [ -z "$1" ]
then
REPO=$(git ls-remote --get-url origin | \
sed -u 's/git@//g; s/https:\/\///g; s/github.com\///g; s/\.git//g')
else
REPO=$1
fi
if [ -z "$2" ]
then
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
else
TAG=$2
fi
BODY=$(awk "/$TAG/ {print; exit}" RS="\n\n" ORS="\n\n" CHANGELOG.md | tail -n+2)
PAYLOAD=$(
jq --null-input \
--arg t "$TAG" \
--arg n "$TAG" \
--arg b "$BODY" \
'{ tag_name: $t, name: $n, body: $b}'
)
TAG_ID=$(curl -s "https://api.github.com/repos/$REPO/releases/tags/$TAG" | jq -r '.id')
curl --fail \
--netrc \
--silent \
--location \
--request PATCH \
--data "$PAYLOAD" \
"https://api.github.com/repos/${REPO}/releases/${TAG_ID}"

3109
yarn.lock

File diff suppressed because it is too large Load Diff