ci: Run pub publish from CI

This commit is contained in:
Jindra 2021-09-01 14:55:59 +02:00 committed by Krille Fear
parent e92802e878
commit 05400ec0ef
1 changed files with 50 additions and 1 deletions

View File

@ -2,6 +2,7 @@ stages:
- coverage
- builddocs
- deploy
- publish
test:
tags:
@ -49,3 +50,51 @@ pages:
- public
only:
- main
dry-run:
stage: publish
image: google/dart
script:
- dart pub get
- dart pub publish --dry-run
only:
- merge_requests
pub-dev:
stage: publish
image: google/dart
script:
- |
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
cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"$(echo "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" | base64 -d)",
"refreshToken":"$(echo "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" | base64 -d)",
"tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}",
"scopes":["https://www.googleapis.com/auth/userinfo.email","openid"],
"expiration":${PUB_DEV_PUBLISH_EXPIRATION}
}
EOF
- dart pub get
- dart pub publish --dry-run
only:
- tags