Skip to content

Commit

Permalink
Merge pull request #3 from nebulab/kennyadsl/save-preview-url
Browse files Browse the repository at this point in the history
Persist the Preview URL for future jobs
  • Loading branch information
kennyadsl authored Mar 27, 2019
2 parents cf0a7b9 + 46a8f35 commit 3d8b696
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ jobs:
echo "export SUBDOMAIN=`echo $CIRCLE_BRANCH | shasum | awk '{print $1}' | head -c 6`" >> $CIRCLE_BUILD_NUM
echo "export CONTAINER=$CIRCLE_PROJECT_REPONAME-\$BRANCH" >> $CIRCLE_BUILD_NUM
echo "export DIRECTORY=$CIRCLE_PROJECT_REPONAME/\$BRANCH" >> $CIRCLE_BUILD_NUM
- run:
name: Write Preview URL to a persisted file
command: |
source $CIRCLE_BUILD_NUM
mkdir -p workspace
echo "https://$SUBDOMAIN.<< parameters.domain >>" > workspace/preview-url
- run:
name: Notify Preview Deploy Started
command: |
Expand Down Expand Up @@ -141,3 +147,7 @@ jobs:
ssh << parameters.user >>@<< parameters.server >> "docker ps | grep $CIRCLE_PROJECT_REPONAME | grep -vE '`cat grep_regex`'" | awk '{print $2}' > old_containers
ssh << parameters.user >>@<< parameters.server >> "docker rm -f "`cat old_containers`""
ssh << parameters.user >>@<< parameters.server >> "rm -fr "`cat old_containers | sed "s/$CIRCLE_PROJECT_REPONAME-/$CIRCLE_PROJECT_REPONAME\//g"`""
- persist_to_workspace:
root: workspace
paths:
- preview-url

0 comments on commit 3d8b696

Please sign in to comment.