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
1 parent
d566c86
commit 78f37b1
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# This script creates/updates credentials.json file which is used | ||
# to authorize publisher when publishing packages to pub.dev | ||
|
||
# Checking whether the secrets are available as environment | ||
# variables or not. | ||
if [ -z "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_ACCESS_TOKEN environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_REFRESH_TOKEN environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_TOKEN_ENDPOINT environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_EXPIRATION}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_EXPIRATION environment variable" | ||
exit 1 | ||
fi | ||
|
||
# Create credentials.json file. | ||
cat <<EOF > ~/.pub-cache/credentials.json | ||
{ | ||
"accessToken":"${PUB_DEV_PUBLISH_ACCESS_TOKEN}", | ||
"refreshToken":"${PUB_DEV_PUBLISH_REFRESH_TOKEN}", | ||
"tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}", | ||
"scopes":["https://www.googleapis.com/auth/userinfo.email","openid"], | ||
"expiration":${PUB_DEV_PUBLISH_EXPIRATION} | ||
} | ||
EOF |