Notes/bin/release.sh

71 lines
1.4 KiB
Bash
Raw Normal View History

2019-07-19 20:35:53 +02:00
#!/usr/bin/env bash
export GITHUB_REPO=trilium-webclipper
if [[ $# -eq 0 ]] ; then
echo "Missing argument of new version"
exit 1
fi
VERSION=$1
if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ;
then
echo "Version ${VERSION} isn't in format X.Y.Z"
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "There are uncommitted changes"
exit 1
fi
echo "Releasing Trilium Web Clipper $VERSION"
jq '.version = "'"$VERSION"'"' manifest.json | sponge manifest.json
git add manifest.json
echo 'module.exports = { buildDate:"'$(date --iso-8601=seconds)'", buildRevision: "'$(git log -1 --format="%H")'" };' > build.js
git add build.js
TAG=v$VERSION
echo "Committing package.json version change"
git commit -m "release $VERSION"
git push
echo "Tagging commit with $TAG"
git tag "$TAG"
git push origin "$TAG"
bin/release-firefox.sh
2019-07-20 12:19:47 +02:00
bin/release-chrome.sh
2019-07-19 20:35:53 +02:00
2019-07-19 23:32:46 +02:00
FIREFOX_BUILD=trilium_web_clipper-$VERSION-an+fx.xpi
2019-07-20 14:38:06 +02:00
CHROME_BUILD=trilium_web_clipper-${VERSION}-chrome.zip
2019-07-19 20:35:53 +02:00
echo "Creating release in GitHub"
github-release release \
--tag "$TAG" \
2019-07-19 21:12:13 +02:00
--name "$TAG release"
2019-07-19 20:35:53 +02:00
echo "Uploading firefox build package"
2019-07-19 20:35:53 +02:00
github-release upload \
--tag "$TAG" \
2019-07-19 23:32:46 +02:00
--name "$FIREFOX_BUILD" \
--file "dist/$FIREFOX_BUILD"
2019-07-19 20:35:53 +02:00
echo "Uploading chrome build package"
github-release upload \
--tag "$TAG" \
--name "$CHROME_BUILD" \
--file "dist/$CHROME_BUILD"
2019-07-19 20:35:53 +02:00
echo "Release finished!"