Commit 91ecada5 authored by zauberstuhl's avatar zauberstuhl Committed by zauberstuhl

Deploy binaries to bintray.com

* use caching while building
* artifacts will expire after a day
parent d2192f33
Pipeline #64 passed with stages
in 45 minutes and 3 seconds
......@@ -8,58 +8,40 @@ variables:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
UPDATE_CHANNEL: alpha
cache:
key: "ganggo"
paths:
- vendor
- node_modules
stages:
- dependency
- test
- package
artifacts:
name: "$UPDATE_CHANNEL"
expire_in: "1 day"
paths:
- updater.*.bin
- build
- deploy
before_script:
- export VERSION=$(git describe --abbrev=0 --tags)
- mkdir -p $GOPATH/src/github.com/ganggo
- ln -s $(pwd) $GOPATH/src/github.com/ganggo/ganggo
install dependencies:
stage: dependency
cache:
key: "ganggo-$CI_PIPELINE_ID"
paths:
- vendor
- node_modules
script:
- make install
- make install
run unit tests:
stage: test
cache:
key: "ganggo-$CI_PIPELINE_ID"
paths:
- vendor
- node_modules
policy: pull
script:
- make test
build with GOARCH=amd64 GOOS=linux:
stage: package
cache:
key: "ganggo-$CI_PIPELINE_ID"
artifacts:
expire_in: "1 day"
paths:
- vendor
- node_modules
policy: pull
- updater.*.bin
stage: build
script:
- export GOARCH=amd64
- export GOOS=linux
- make release
build with GOARCH=amd64 GOOS=windows:
stage: package
cache:
key: "ganggo-$CI_PIPELINE_ID"
artifacts:
expire_in: "1 day"
paths:
- vendor
- node_modules
policy: pull
- updater.*.bin
stage: build
script:
- export CGO_ENABLED=1
- export CXX=x86_64-w64-mingw32-g++
......@@ -68,13 +50,11 @@ build with GOARCH=amd64 GOOS=windows:
- export GOOS=windows
- make release
build with GOARCH=386 GOOS=windows:
stage: package
cache:
key: "ganggo-$CI_PIPELINE_ID"
artifacts:
expire_in: "1 day"
paths:
- vendor
- node_modules
policy: pull
- updater.*.bin
stage: build
script:
- export CGO_ENABLED=1
- export CXX=i686-w64-mingw32-g++
......@@ -83,13 +63,11 @@ build with GOARCH=386 GOOS=windows:
- export GOOS=windows
- make release
build with GOARCH=arm GOOS=linux GOARM=7:
stage: package
cache:
key: "ganggo-$CI_PIPELINE_ID"
artifacts:
expire_in: "1 day"
paths:
- vendor
- node_modules
policy: pull
- updater.*.bin
stage: build
script:
- export CGO_ENABLED=1
- export CC=arm-linux-gnueabihf-gcc
......@@ -97,3 +75,13 @@ build with GOARCH=arm GOOS=linux GOARM=7:
- export GOOS=linux
- export GOARM=7
- make release
deploy artifacts to bintray:
artifacts:
expire_in: "1 day"
paths:
- updater.*.bin
stage: deploy
script:
- bash ci/scripts/bintray.sh
when: manual
allow_failure: true
#!/bin/bash
API=https://api.bintray.com
# NOTE will be set via gitlab protected vars
# BINTRAY_USER=$1
# BINTRAY_API_KEY=$2
# BINTRAY_REPO=$3
PCK_NAME=${UPDATE_CHANNEL}
PCK_VERSION=$(git describe --abbrev=0 --tags)
CURL="curl -u${BINTRAY_USER}:${BINTRAY_API_KEY} -H Content-Type:application/json -H Accept:application/json"
data="{
\"name\": \"${PCK_NAME}\",
\"desc\": \"${CI_COMMIT_MESSAGE}\",
\"vcs_url\": \"${CI_REPOSITORY_URL}\",
\"licenses\": [\"GPL-3.0\"],
\"issue_tracker_url\": \"${CI_PROJECT_URL}/issues\",
\"website_url\": \"${CI_PROJECT_URL}/wikis/home\",
\"desc_url\": \"${CI_PROJECT_URL}\",
\"labels\": [\"ganggo\", \"gitlab\", \"deploy\"],
\"public_download_numbers\": true,
\"public_stats\": true
}"
echo "Creating package ${PCK_NAME}..."
echo $(${CURL} -X POST -d "${data}" ${API}/packages/${BINTRAY_REPO})
for BIN in $(ls updater.*.bin); do
status_code=$(${CURL} --write-out %{http_code} --silent --output /dev/null \
-T ${BIN} -H X-Bintray-Package:${PCK_NAME} \
-H X-Bintray-Version:${PCK_VERSION} ${API}/content/${BINTRAY_REPO}/${BIN})
if [ $status_code -eq 201 ]; then
echo "Publishing ${BIN}..."
echo $(${CURL} -X POST -d "{ \"discard\": \"false\" }" \
${API}/content/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/publish)
else
echo "Cannot publish ${BIN}!"
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment