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

Commit

Permalink
Release helper script (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghomanyi committed Jul 18, 2019
1 parent 08e1584 commit 6bd76a8
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .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 @@ -47,10 +57,35 @@ jobs:
path: target/daml-test-reports
- store_artifacts:
path: target/daml-test-reports
- persist_to_workspace:
root: target
paths:
- "*.dar"

github_release:
executor: docker_buildpack
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Push a new github release
command: |
./scripts/release.sh ex-mortgage-repackaging
workflows:
version: 2
build_and_test:
jobs:
- daml_test:
daml_sdk_version: "0.13.12"
build_and_release:
jobs:
- daml_test:
<<: *only-release-tags
daml_sdk_version: "0.13.12"
- github_release:
context: github-refapp-repo-context
requires:
- daml_test
<<: *only-release-tags
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
node_modules
package-lock.json
target
ui-backend.conf
.daml
2 changes: 1 addition & 1 deletion Dockerfile-sandbox
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG sdk_version=0.13.12

WORKDIR /home/sdk

COPY dist/mortgage-repackaging.dar /home/sdk/
COPY .daml/dist/mortgage-repackaging.dar /home/sdk/
COPY scripts/install-daml.sh /home/sdk/

RUN /bin/bash -c "apt-get update --no-show-upgraded && apt-get install wget openjdk-8-jdk -y"
Expand Down
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
7 changes: 7 additions & 0 deletions ui-backend.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
users
{
Operator { party = "Operator", },
Securitizer { party = "Securitizer", },
MortgagePoolHolder { party = "MortgagePoolHolder", },
Registry { party = "Registry", },
}

0 comments on commit 6bd76a8

Please sign in to comment.