From fc8a3a8ec264f3ac1cbe8c8b99072db33b1415a1 Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Fri, 28 Jul 2023 18:17:57 +0530 Subject: [PATCH] removes unnecessary scripts --- .gitignore | 4 +- addDevTag | 94 ------------------- addReleaseTag | 254 -------------------------------------------------- 3 files changed, 3 insertions(+), 349 deletions(-) delete mode 100755 addDevTag delete mode 100755 addReleaseTag diff --git a/.gitignore b/.gitignore index 2244021e2..a0a9b1d59 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,6 @@ local.properties .DS_Store *.iml -ee/bin \ No newline at end of file +ee/bin +addDevTag +addReleaseTag \ No newline at end of file diff --git a/addDevTag b/addDevTag deleted file mode 100755 index 3c1688378..000000000 --- a/addDevTag +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -# get version------------ -version=`cat build.gradle | grep -e "version =" -e "version="` - -while IFS='"' read -ra ADDR; do - counter=0 - for i in "${ADDR[@]}"; do - if [ $counter == 1 ] - then - version=$i - fi - counter=$(($counter+1)) - done -done <<< "$version" - -branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || -branch_name="(unnamed branch)" # detached HEAD - -branch_name=${branch_name##refs/heads/} - -# check if branch is correct based on the version----------- - -if ! [[ $version == $branch_name* ]] -then - RED='\033[0;31m' - NC='\033[0m' # No Color - printf "${RED}Adding tag to wrong branch. Stopping process${NC}\n" - exit 1 -fi - - - -git fetch --prune --prune-tags - -# get current commit hash------------ -if [ $# -eq 0 ] -then - commit_hash=`git log --pretty=format:'%H' -n 1` -else - commit_hash=$1 -fi - - -# check if current commit already has a tag or not------------ - -if [[ `git tag -l --points-at $commit_hash` == "" ]] -then - continue=1 -else - RED='\033[0;31m' - NC='\033[0m' - printf "${RED}This commit already has a tag. Please remove that and re-run this script${NC}\n" - echo "git tag --delete " - echo "git push --delete origin " - exit 1 -fi - - -# check if release version of this tag exists------------ - -if git rev-parse v$version >/dev/null 2>&1 -then - RED='\033[0;31m' - NC='\033[0m' - printf "${RED}The released version of this tag already exists${NC}\n" - exit 1 -fi - -# add an empty commit if the user has not given a commit hash so that we are sure it's built------------ -if [ $# -eq 0 ] -then - ./runBuild - if [[ $? -ne 0 ]] - then - echo "Failed to build" - exit 1 - fi - - # We have to do git add twice like this other jar changes in ./jar/* do not get added - git add --all "./jar/*" > /dev/null 2>&1 - git add --all "./**/jar/*" > /dev/null 2>&1 - git commit --allow-empty -m"adding dev-v$version tag to this commit to ensure building" - git push - commit_hash=`git log --pretty=format:'%H' -n 1` -fi - -# tag this commit and push it------------ - -git tag dev-v$version $commit_hash - -git push --tags - -echo "Added dev tag. PLEASE BE SURE TO CHECK THAT THE LATEST JARS HAVE BEEN COMMITTED!" diff --git a/addReleaseTag b/addReleaseTag deleted file mode 100755 index 38591efe3..000000000 --- a/addReleaseTag +++ /dev/null @@ -1,254 +0,0 @@ -#!/bin/bash -# working directory is inside supertokens-*/. Expects a releasePassword file to be ../ -# ./addReleaseTag [--forced] -# get version------------ -version=`cat build.gradle | grep -e "version =" -e "version="` - -while IFS='"' read -ra ADDR; do - counter=0 - for i in "${ADDR[@]}"; do - if [ $counter == 1 ] - then - version=$i - fi - counter=$(($counter+1)) - done -done <<< "$version" - -branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || -branch_name="(unnamed branch)" # detached HEAD - -branch_name=${branch_name##refs/heads/} - -git fetch --prune --prune-tags - -password=`cat ../apiPassword` - -# get current package type -if [[ `pwd` == *-core ]] -then - packageType="core" -elif [[ `pwd` == *-plugin-interface ]] -then - packageType="plugin-interface" -else - packageType="plugin" -fi - -# we get from the server is the tests have passed or not. -if [[ $packageType == "core" ]] -then - testPassedJson=`curl -s -X GET \ - "https://api.supertokens.io/0/core?password=$password&planType=FREE&version=$version" \ - -H 'api-version: 0'` -elif [[ $packageType == "plugin" ]] -then - p_name=`cat ./build.gradle | grep -e "def pluginName =" -e "def pluginName="` - while IFS='"' read -ra ADDR; do - counter=0 - for i in "${ADDR[@]}"; do - if [ $counter == 1 ] - then - p_name=$i - fi - counter=$(($counter+1)) - done - done <<< "$p_name" - testPassedJson=`curl -s -X GET \ - "https://api.supertokens.io/0/plugin?password=$password&planType=FREE&version=$version&name=$p_name" \ - -H 'api-version: 0'` -else - testPassedJson="ignore" -fi - -if [[ $testPassedJson == "ignore" ]] -then - testPassed="true" -else - if [[ `echo $testPassedJson | jq .testPassed` == "null" ]] - then - testPassed="false" - else - testPassed=`echo $testPassedJson | jq .testPassed` - fi -fi - -if [[ $testPassed != "true" ]] -then - RED='\033[0;31m' - NC='\033[0m' # No Color - printf "${RED}All tests have not passed. So stopping process.${NC}\n" - exit 1 -fi - -# we get from the server if the current package can be released safely or not -if [[ $1 != "--forced" ]] -then - if [[ $packageType == "core" ]] - then - canReleaseSafelyResponse=`curl -s -X GET \ - "https://api.supertokens.io/0/core/release/check?password=$password&planType=FREE&version=$version" \ - -H 'api-version: 0'` - else - canReleaseSafelyResponse="ignore" - fi - - if [[ $canReleaseSafelyResponse == "ignore" ]] - then - canReleaseSafely="true" - else - if [[ `echo $canReleaseSafelyResponse | jq .canRelease` == "null" ]] - then - canReleaseSafely="false" - else - canReleaseSafely=`echo $canReleaseSafelyResponse | jq .canRelease` - fi - fi - - if [[ $canReleaseSafely != "true" ]] - then - RED='\033[0;31m' - NC='\033[0m' # No Color - printf "${RED}Cannot release core. Have you released corresponding plugin and drivers?${NC}\n" - exit 1 - fi -fi - -# check that current commit has a dev tag and that it is the correct version -# get current commit hash------------ -if [ $# -eq 0 ] -then - commit_hash=`git log --pretty=format:'%H' -n 1` -else - commit_hash=$1 -fi - - -# check if current commit already has a tag or not------------ -currTag=`git tag -l --points-at $commit_hash` - -expectedCurrTag=dev-v$version - -if [[ $currTag == $expectedCurrTag ]] -then - continue=1 -else - RED='\033[0;31m' - NC='\033[0m' - printf "${RED}This commit does not have the right tag for the version you want to release.${NC}\n" - exit 1 -fi - -releasePassword=`cat ../releasePassword` - -# now we call the patch API to make it release mode -if [[ $packageType == "core" ]] -then - responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PATCH \ - https://api.supertokens.io/0/core \ - -H 'Content-Type: application/json' \ - -H 'api-version: 0' \ - -d "{ - \"password\": \"$releasePassword\", - \"planType\":\"FREE\", - \"version\":\"$version\", - \"release\": true - }"` -elif [[ $packageType == "plugin" ]] -then - responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PATCH \ - https://api.supertokens.io/0/plugin \ - -H 'Content-Type: application/json' \ - -H 'api-version: 0' \ - -d "{ - \"password\": \"$releasePassword\", - \"planType\":\"FREE\", - \"name\":\"$p_name\", - \"version\":\"$version\", - \"release\": true - }"` -else - responseStatus=200 -fi - -if [ $responseStatus -ne "200" ] -then - RED='\033[0;31m' - NC='\033[0m' - printf "${RED}patch api failed. Please try again.${NC}\n" - git tag --delete v$version - git push --delete origin v$version - exit 1 -fi - -git tag --delete $currTag -git push --delete origin $currTag - -git tag v$version -git push --tags - -if [[ $packageType == "core" ]] -then - response=`curl -s -X GET \ - "https://api.supertokens.io/0/core/latest/check?password=$password&planType=FREE&version=$version" \ - -H 'api-version: 0'` - response=`echo $response | jq .isLatest` -elif [[ $packageType == "plugin" ]] -then - response=`curl -s -X GET \ - "https://api.supertokens.io/0/plugin/latest/check?password=$password&planType=FREE&version=$version&name=$p_name" \ - -H 'api-version: 0'` - response=`echo $response | jq .isLatest` -else - response=`curl -s -X GET \ - "https://api.supertokens.io/0/plugin-interface/latest/check?password=$password&planType=FREE&version=$version" \ - -H 'api-version: 0'` - response=`echo $response | jq .isLatest` -fi - -if [[ $response == "null" ]] -then - RED='\033[0;31m' - NC='\033[0m' - printf "${RED}error while determining if we should push to master or not. Please do so manually if needed:${NC}\n" - if [[ $branch_name == "(unnamed branch)" ]] - then - echo "git checkout -b forrelease" - echo "git merge master" - echo "git checkout master" - echo "git merge forrelease" - echo "git push" - echo "git checkout forrelease" - exit 1 - else - echo "git merge master" - echo "git checkout master" - echo "git merge $branch_name" - echo "git push" - echo "git checkout $branch_name" - exit 1 - fi - -fi - -if [[ $response == "true" ]] -then - echo "pushing to master..." - if [[ $branch_name == "(unnamed branch)" ]] - then - git checkout -b forrelease - git merge master - git checkout master - git merge forrelease - git push - git checkout forrelease - echo "Done! Please delete this branch" - else - git merge master - git checkout master - git merge $branch_name - git push - git checkout $branch_name - echo "Done!" - fi -fi \ No newline at end of file