diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 12d91789..9dc8c829 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v1 + - uses: actions/setup-node@v3 + with: + node-version: 14 - name: Install Dependencies run: yarn --frozen-lockfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ab4e27c9..e3a7a74d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 - name: Install Dependencies run: yarn --frozen-lockfile @@ -30,5 +33,10 @@ jobs: - name: Run tests run: yarn test + - name: Publish beta + if: github.event.release.prerelease != false + run: sh ./bin/publish.sh beta + - name: Publish + if: github.event.release.prerelease != true run: sh ./bin/publish.sh diff --git a/bin/publish.sh b/bin/publish.sh index 52a9538e..f1d3ab22 100755 --- a/bin/publish.sh +++ b/bin/publish.sh @@ -1,28 +1,28 @@ #!/bin/bash - +beta=$1 status=0 -(./bin/try-publish.sh "core" "api-client") || status=1 -(./bin/try-publish.sh "core" "apollo-client") || status=1 -(./bin/try-publish.sh "core" "apollo-links") || status=1 -(./bin/try-publish.sh "core" "auth") || status=1 -(./bin/try-publish.sh "core" "utils") || status=1 -(./bin/try-publish.sh "core" "validate") || status=1 -(./bin/try-publish.sh "core" "api-token-auth-client") || status=1 -(./bin/try-publish.sh "core" "web-auth0-auth-client") || status=1 -(./bin/try-publish.sh "core" "web-native-auth-client") || status=1 -(./bin/try-publish.sh "core" "web-cognito-auth-client") || status=1 -(./bin/try-publish.sh "core" "web-oauth-client") || status=1 -(./bin/try-publish.sh "core" "8base-sdk") || status=1 +(./bin/try-publish.sh "core" "api-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "apollo-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "apollo-links" "$beta") || status=1 +(./bin/try-publish.sh "core" "auth" "$beta") || status=1 +(./bin/try-publish.sh "core" "utils" "$beta") || status=1 +(./bin/try-publish.sh "core" "validate" "$beta") || status=1 +(./bin/try-publish.sh "core" "api-token-auth-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "web-auth0-auth-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "web-native-auth-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "web-cognito-auth-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "web-oauth-client" "$beta") || status=1 +(./bin/try-publish.sh "core" "8base-sdk" "$beta") || status=1 -(./bin/try-publish.sh "react" "app-provider") || status=1 -(./bin/try-publish.sh "react" "auth") || status=1 -(./bin/try-publish.sh "react" "crud") || status=1 -(./bin/try-publish.sh "react" "file-input") || status=1 -(./bin/try-publish.sh "react" "forms") || status=1 -(./bin/try-publish.sh "react" "permissions-provider") || status=1 -(./bin/try-publish.sh "react" "table-schema-provider") || status=1 -(./bin/try-publish.sh "react" "utils") || status=1 -(./bin/try-publish.sh "react" "8base-react-sdk") || status=1 +(./bin/try-publish.sh "react" "app-provider" "$beta") || status=1 +(./bin/try-publish.sh "react" "auth" "$beta") || status=1 +(./bin/try-publish.sh "react" "crud" "$beta") || status=1 +(./bin/try-publish.sh "react" "file-input" "$beta") || status=1 +(./bin/try-publish.sh "react" "forms" "$beta") || status=1 +(./bin/try-publish.sh "react" "permissions-provider" "$beta") || status=1 +(./bin/try-publish.sh "react" "table-schema-provider" "$beta") || status=1 +(./bin/try-publish.sh "react" "utils" "$beta") || status=1 +(./bin/try-publish.sh "react" "8base-react-sdk" "$beta") || status=1 exit $status diff --git a/bin/try-publish.sh b/bin/try-publish.sh index 1b5b6fa5..39b1ebde 100755 --- a/bin/try-publish.sh +++ b/bin/try-publish.sh @@ -2,6 +2,7 @@ scope=$1 package=$2 +beta=$3 status=0 @@ -29,7 +30,13 @@ if [ "$published" != "$version" ]; then fi fi - npm publish --access public; if [ "$?" != "0" ]; then status=1; fi + if [ "$beta" != "beta" ]; then + npm publish --access public; + else + npm publish --tag beta --access public; + fi + + if [ "$?" != "0" ]; then status=1; fi else echo "Current version of the package already published to the NPM." fi