diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e61cfe9d..c88639e4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - build: + build: docker: - image: cirrusci/flutter steps: @@ -11,4 +11,30 @@ jobs: - run: flutter doctor - run: pub get - run: flutter test - - run: dartanalyzer --options analysis_options.yaml --fatal-warnings lib \ No newline at end of file + - run: dartanalyzer --options analysis_options.yaml --fatal-warnings lib + + release: + docker: + - image: cirrusci/flutter + steps: + - checkout + - run: ./release.sh + +workflows: + version: 2 + build-test-and-approval-deploy: + jobs: + - build + - hold: + type: approval + requires: + - build + filters: + branches: + only: master + - release: + requires: + - hold + filters: + branches: + only: master \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index f5c05e4eb..51c6eeaf7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: instabug_flutter -version: 0.0.1-alpha.1 +version: 0.0.3-alpha.1 description: >- Instabug is an in-app feedback and bug reporting tool for mobile apps. With just a simple shake, your users or beta testers can report bugs or diff --git a/release.sh b/release.sh new file mode 100755 index 000000000..209b783f7 --- /dev/null +++ b/release.sh @@ -0,0 +1,31 @@ +#!/bin/sh +VERSION=$(egrep -o "version: ([0-9]-*.*)+[0-9]" pubspec.yaml | cut -d ":" -f 2) +if [ ! "${VERSION}" ] || [ -z "${VERSION}" ];then + echo "Instabug: err: Version Number not found." + exit 1 +else + mkdir -p .pub-cache + cat < $HOME/.pub-cache/credentials.json + { + "accessToken":"${ACCESS_TOKEN}", + "refreshToken":"${REFRESH_TOKEN}", + "tokenEndpoint":"https://accounts.google.com/o/oauth2/token", + "scopes":["https://www.googleapis.com/auth/userinfo.email","openid"], + "expiration":${EXPIRATION} + } +EOF + flutter packages pub publish -f + + OWNER="Instabug" + REPOSITORY="Instabug-Flutter" + ACCESS_TOKEN=${RELEASE_GITHUB_TOKEN} + VERSION=$(echo ${VERSION} | sed 's/ //1') + curl --data '{"tag_name": "'$VERSION'", + "target_commitish": "master", + "name": "'$VERSION'", + "body": "Release of version '$VERSION'", + "draft": false, + "prerelease": false}' https://api.github.com/repos/$OWNER/$REPOSITORY/releases?access_token=$ACCESS_TOKEN + echo "https://api.github.com/repos/$OWNER/$REPOSITORY/releases?access_token=$ACCESS_TOKEN" +fi +