From 642076a231112fb529025071cfb95c686ed71613 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Sat, 29 Dec 2018 00:06:39 -0500 Subject: [PATCH] .gitlab-ci.yml: add automated aws push on release --- .gitlab-ci.yml | 30 ++++++++++++++++++------------ scripts/gitlab-ci-build-prescript | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 scripts/gitlab-ci-build-prescript diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3757a90..1e8f190 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,7 @@ stages: - build-docker - docker-registry-master - docker-registry-tags + - aws-upload-tags check-dco: stage: check-dco @@ -21,28 +22,33 @@ check-dco: build-src: stage: build-src image: debian:buster - variables: - GOPATH: $CI_PROJECT_DIR except: - master - tags before_script: - - apt update - - apt install -y curl gnupg git make golang - - mkdir -p /go/src /go/bin /go/pkg + - bash $CI_PROJECT_DIR/scripts/gitlab-ci-build-prescript + script: - export GOPATH=/go - export PATH=$PATH:/go/bin - - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - - ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME - - curl -sL https://deb.nodesource.com/setup_10.x | bash - - - apt update - - apt install -y nodejs - - npm install -g yarn@1.10.0 - script: - cd /go/src/$CI_PROJECT_NAME - make devel - make prod +aws-upload-tags: + stage: aws-upload-tags + image: debian:buster + only: + - tags + before_script: + - bash $CI_PROJECT_DIR/scripts/gitlab-ci-build-prescript + script: + - export GOPATH=/go + - export PATH=$PATH:/go/bin + - cd /go/src/$CI_PROJECT_NAME + - make prod + - cd build/prod && tar -zcvf /commento-linux-amd64-$(git describe --tags).tgz . + - aws s3 cp /commento-linux-amd64-$(git describe --tags).tgz s3://commento-release/ + build-docker: stage: build-docker image: docker:stable diff --git a/scripts/gitlab-ci-build-prescript b/scripts/gitlab-ci-build-prescript new file mode 100644 index 0000000..19e92d7 --- /dev/null +++ b/scripts/gitlab-ci-build-prescript @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +mkdir -p /go/src /go/bin /go/pkg +ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME + +apt update +apt install -y curl gnupg git make golang python +export GOPATH=/go +export PATH=$PATH:/go/bin +curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + +curl -sL https://deb.nodesource.com/setup_10.x | bash - +apt install -y nodejs +npm install -g yarn@1.10.0 + +apt install -y python python-pip +pip install awscli