]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - add dev build pipeline to circleci
authorDylan William Hardison <dylan@hardison.net>
Wed, 4 Apr 2018 14:37:09 +0000 (10:37 -0400)
committerDylan William Hardison <dylan@hardison.net>
Wed, 4 Apr 2018 14:37:09 +0000 (10:37 -0400)
.circleci/build.sh [new file with mode: 0644]
.circleci/deploy.sh [new file with mode: 0644]

diff --git a/.circleci/build.sh b/.circleci/build.sh
new file mode 100644 (file)
index 0000000..7d476c8
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -euf -o pipefail
+
+docker build \
+    --build-arg CI="$CI" \
+    --build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \
+    --build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \
+    -t bmo .
+
+docker run --name bmo --entrypoint true bmo
+docker cp bmo:/app/version.json build_info/version.json
diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh
new file mode 100644 (file)
index 0000000..3d8a385
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -euf -o pipefail
+
+[[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0
+docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
+
+if [[ "$CIRCLE_BRANCH" == "master" ]]; then
+    TAG="$(cat /app/build_info/tag.txt)"
+    [[ -n "$GITHUB_PERSONAL_TOKEN" ]] || exit 0
+    if [[ -n "$TAG" && -f build_info/publish.txt ]]; then
+    git config credential.helper "cache --timeout 120"
+    git config user.email "$GITHUB_EMAIL"
+    git config user.name "$GITHUB_NAME"
+    git tag $TAG
+    git push https://${GITHUB_PERSONAL_TOKEN}:x-oauth-basic@github.com/$GITHUB_REPO.git $TAG
+    docker tag bmo "$DOCKERHUB_REPO:$TAG"
+    docker push "$DOCKERHUB_REPO:$TAG"
+    fi
+    docker tag bmo "$DOCKERHUB_REPO:latest"
+    docker push "$DOCKERHUB_REPO:latest"
+elif [[ "$CIRCLE_BRANCH" == "development" ]]; then
+    docker tag bmo "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}"
+    docker push "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}"
+fi