forked from goodrain/rainbond-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·30 lines (23 loc) · 1.25 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
IMAGE_DOMAIN=${IMAGE_DOMAIN:-'docker.io'}
IMAGE_NAMESPACE=${IMAGE_NAMESPACE:-'rainbond'}
DOMESTIC_DOMAIN=${DOMESTIC_DOMAIN:-'registry.cn-hangzhou.aliyuncs.com'}
DOMESTIC_NAMESPACE=${DOMESTIC_NAMESPACE:-'goodrain'}
VERSION=${VERSION:-'latest'}
AUTO_BUILD=${AUTO_BUILD:-'true'}
# git clone rainbond docs all commits
git clone -b main https://github.com/goodrain/rainbond-docs.git && cd rainbond-docs || exit
docker run --rm -v /node_modules:/app/node_modules -v "$PWD":/app -w /app node:16.14 sh -c "yarn install && yarn build"
docker build -t "$IMAGE_DOMAIN"/"$IMAGE_NAMESPACE"/rainbond-docs:"${VERSION}" .
if [ "$DOCKER_USERNAME" ]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
docker push "$IMAGE_DOMAIN"/"$IMAGE_NAMESPACE"/rainbond-docs:"${VERSION}"
fi
if [ "$DOMESTIC_USERNAME" ]; then
docker login -u "$DOMESTIC_USERNAME" -p "$DOMESTIC_PASSWORD" "$DOMESTIC_DOMAIN"
docker tag "$IMAGE_DOMAIN"/"$IMAGE_NAMESPACE"/rainbond-docs:"${VERSION}" "$DOMESTIC_DOMAIN"/"$DOMESTIC_NAMESPACE"/rainbond-docs:"${VERSION}"
docker push "$DOMESTIC_DOMAIN"/"$DOMESTIC_NAMESPACE"/rainbond-docs:"${VERSION}"
fi
if [ "$AUTO_BUILD" = 'true' ]; then
curl -d "{\"secret_key\":\"$RAINBOND_SECRET\"}" -H "Content-type: application/json" -X POST "$RAINBOND_API"
fi