Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Adding release support to CI (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghomanyi committed Jul 17, 2019
1 parent 50deda2 commit 02137c9
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
48 changes: 47 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ executors:
daml-executor:
docker:
- image: circleci/openjdk:11.0-jdk
docker_buildpack:
docker:
- image: circleci/buildpack-deps:xenial

only-release-tags: &only-release-tags
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/

commands:
install_sdk:
Expand Down Expand Up @@ -51,7 +61,17 @@ jobs:
- run:
name: Run Blackduck Detect
command: |
bash <(curl -s https://raw.githubusercontent.com/DACH-NY/security-blackduck/master/synopsys-detect) ci-build digitalasset_ex-healthcare-claims-processing master --logging.level.com.synopsys.integration=DEBUG
bash <(curl -s https://raw.githubusercontent.com/DACH-NY/security-blackduck/master/synopsys-detect) ci-build digitalasset_ex-healthcare-claims-processing master --logging.level.com.synopsys.integration=DEBUG --detect.notices.report=true
- run:
command: cp digitalasset_ex_healthcare_claims_processing_master_Black_Duck_Notices_Report.txt target/NOTICE
- persist_to_workspace:
root: target
paths:
- "*.jar"
- "*.dar"
- "lib"
- "NOTICE"

daml_test:
parameters:
daml_sdk_version:
Expand All @@ -78,6 +98,17 @@ jobs:
- store_artifacts:
path: target/daml-test-reports

github_release:
executor: docker_buildpack
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Push a new github release
command: |
./scripts/release.sh ex-healthcare-claims-processing
workflows:
version: 2
build_and_test:
Expand All @@ -87,3 +118,18 @@ workflows:
- mvn_test:
daml_sdk_version: "0.13.12"
context: blackduck
build_and_release:
jobs:
- daml_test:
<<: *only-release-tags
daml_sdk_version: "0.13.12"
- mvn_test:
<<: *only-release-tags
daml_sdk_version: "0.13.12"
context: blackduck
- github_release:
context: github-refapp-repo-context
requires:
- daml_test
- mvn_test
<<: *only-release-tags
47 changes: 47 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

set -e

appName="$1"
if [ "$appName" == "" ]
then
echo "No appname defined"
exit 1
fi

# download hub
pushd ${HOME}
wget https://github.com/github/hub/releases/download/v2.12.1/hub-linux-amd64-2.12.1.tgz
tar xvzf hub-linux-amd64-2.12.1.tgz
export PATH="${HOME}/hub-linux-amd64-2.12.1/bin/:${PATH}"
popd

export GITHUB_TOKEN="${GITHUB_REFAPP_MACHINE_TOKEN}"
version=$(git describe --abbrev=0 --tags)
number=$(echo $version | cut -c 2-)

echo "testing if tag is on master"
if git merge-base --is-ancestor $(git rev-parse $version) $(git rev-parse master)
then
echo "collecting package"
fullname="$appName-$number"
mkdir -p "/tmp/workspacetarget/$fullname/bin"
cp -r * "/tmp/workspacetarget/$fullname/"
pushd "/tmp/workspace"
cp -r * "/tmp/workspacetarget/$fullname/bin/"
popd
echo "archiving"
pushd "/tmp/workspacetarget"
tar -czf "$fullname.tar.gz" "$fullname"
popd

echo "releasing $version"
hub release create \
--attach "/tmp/workspacetarget/$fullname.tar.gz" \
--message "Release $version" \
"$version"
fi

0 comments on commit 02137c9

Please sign in to comment.