This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
18 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,29 +6,6 @@ CUR_DIR=`pwd` | |
APP_VERSION=$(cat VERSION) | ||
REPO_URL=mageddo/bookmark-notes | ||
|
||
API_PATH=${API_PATH:-$CUR_DIR} | ||
BUILD_PATH=${BUILD_PATH:-$API_PATH/build} | ||
|
||
create_release(){ | ||
|
||
PAYLOAD=`echo '{ | ||
"tag_name": "VERSION", | ||
"target_commitish": "TARGET", | ||
"name": "VERSION", | ||
"body": "", | ||
"draft": false, | ||
"prerelease": true | ||
}' | sed -e "s/VERSION/$APP_VERSION/" | sed -e "s|TARGET|$CURRENT_BRANCH|"` && \ | ||
TAG_ID=`curl -i -s -f -X POST "https://api.github.com/repos/$REPO_URL/releases?access_token=$REPO_TOKEN" \ | ||
--data "$PAYLOAD" | grep -o -E 'id": [0-9]+'| awk '{print $2}' | head -n 1` | ||
|
||
} | ||
|
||
upload_file(){ | ||
curl --data-binary "@$SOURCE_FILE" -i -w '\n' -f -s -X POST -H 'Content-Type: application/octet-stream' \ | ||
"https://uploads.github.com/repos/$REPO_URL/releases/$TAG_ID/assets?name=$TARGET_FILE&access_token=$REPO_TOKEN" | ||
} | ||
|
||
apply_version(){ | ||
|
||
sed -i -E "s/BOOKMARK_NOTES_VERSION=.+/BOOKMARK_NOTES_VERSION=$APP_VERSION/g" Dockerfile.java | ||
|
@@ -44,16 +21,11 @@ case $1 in | |
|
||
;; | ||
|
||
deps ) | ||
|
||
cd ${API_PATH} && go get -v github.com/golang/dep/cmd/dep && dep ensure -v | ||
|
||
;; | ||
|
||
build ) | ||
|
||
echo "> starting build $APP_VERSION" | ||
./gradlew clean heartbeat build nativeImage copyStatics --info | ||
#./gradlew clean heartbeat build nativeImage copyStatics --info | ||
./gradlew clean heartbeat build --info | ||
echo "> build success" | ||
|
||
;; | ||
|
@@ -69,45 +41,19 @@ case $1 in | |
|
||
upload-release ) | ||
|
||
if [ "$REPO_TOKEN" = "" ] ; then echo "REPO_TOKEN cannot be empty"; exit 1; fi | ||
|
||
if [ "`git config user.email || echo ''`" = "" ]; then | ||
echo '> custom config' | ||
git config user.name `git config user.name || echo 'CI BOT'` | ||
git config user.email `git config user.email || echo '[email protected]'` | ||
fi | ||
echo '> config' | ||
git config -l | ||
echo '' | ||
|
||
REMOTE="https://${REPO_TOKEN}@github.com/${REPO_URL}.git" | ||
|
||
git checkout -b build_branch ${CURRENT_BRANCH} | ||
echo "> Repository added, currentBranch=${CURRENT_BRANCH}" | ||
|
||
git commit -am "Releasing ${APP_VERSION}" # if there is nothing to commit the program will exits | ||
git tag ${APP_VERSION} | ||
git push "$REMOTE" "build_branch:${CURRENT_BRANCH}" | ||
git status | ||
echo "> Branch pushed - Branch $CURRENT_BRANCH" | ||
|
||
create_release | ||
|
||
echo "> Release created with id $TAG_ID" | ||
|
||
SOURCE_FILE="build/native-image/dist/bookmark-notes.zip" | ||
TARGET_FILE=bookmark-notes-linux-amd64-$APP_VERSION.zip | ||
echo "> Source file hash" | ||
md5sum $SOURCE_FILE && ls -lha $SOURCE_FILE | ||
DESC=$(cat RELEASE-NOTES.md | awk 'BEGIN {RS="|"} {print substr($0, 0, index(substr($0, 3), "###"))}' | sed ':a;N;$!ba;s/\n/\\r\\n/g') | ||
|
||
upload_file | ||
# SOURCE_FILE="build/native-image/dist/bookmark-notes.zip" | ||
# TARGET_FILE=bookmark-notes-linux-amd64-$APP_VERSION.zip | ||
# | ||
# cp ${SOURCE_FILE} ${TARGET_FILE} | ||
|
||
SOURCE_FILE="build/distributions/bookmark-notes.zip" | ||
TARGET_FILE=bookmark-notes-$APP_VERSION.zip | ||
echo "> Source file hash" | ||
md5sum $SOURCE_FILE && ls -lha $SOURCE_FILE | ||
SOURCE_FILE_2="build/distributions/bookmark-notes.zip" | ||
TARGET_FILE_2=bookmark-notes-$APP_VERSION.zip | ||
cp ${SOURCE_FILE_2} ${TARGET_FILE_2} | ||
|
||
upload_file | ||
# github-cli release mageddo bookmark-notes $APP_VERSION $CURRENT_BRANCH "${DESC}" ${TARGET_FILE} ${TARGET_FILE_2} | ||
github-cli release mageddo bookmark-notes $APP_VERSION $CURRENT_BRANCH "${DESC}" ${TARGET_FILE_2} | ||
|
||
;; | ||
|
||
|