Skip to content

Commit

Permalink
CD configuration for publishing releases to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
cthree committed Mar 30, 2017
1 parent c2477fb commit c17cd07
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
deploy_hex:
docker:
- image: elixir:1.4
- image: cthree87/docker-elixir-ci:latest

working_directory: ~/ex_lcd_deploy

Expand All @@ -32,11 +32,13 @@ jobs:
- run: mix local.rebar --force
- run: mix deps.get
- run: mix deps.compile
# - run: mix hex.auth something something??

# Deploy to Hex
- deploy:
command: |
if [ ${CIRCLE_BRANCH} == "master" ]; then
# publish the package release here...
# Hex authentication expect script
expect .circleci/hex_auth.expect
# Publish the new release to hex
expect .circleci/hex_publish.expect
fi
30 changes: 30 additions & 0 deletions .circleci/hex_auth.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/expect

set timeout 9
set hex_user "$env(HEX_USER)"
set hex_password "$env(HEX_PW)"
log_user 0

spawn mix hex.user auth

expect {
timeout { send_user "\n Failed authenticating with hex\n"; exit 1 }
"Username:"
}

send "$hex_user\r"

expect {
"Password:"
}

send "$hex_password\r"

expect {
"*API key with user password..."
}

send_user "\nSuccessfully Authenticated.\n"

wait
close
24 changes: 24 additions & 0 deletions .circleci/hex_publish.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/expect

set timeout 9
set hex_password "$env(HEX_PW)"
log_user 0

spawn mix hex.publish

expect {
"Password:"
}

send "$hex_password\r"

log_user 1

expect {
"*[Yn]?"
}

send "Y\r"

wait
close

0 comments on commit c17cd07

Please sign in to comment.