mirror of
https://github.com/alrayyes/wercker-surge-deploy-step
synced 2023-11-13 18:16:40 +00:00
initial import
This commit is contained in:
commit
ff79a81300
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © Ryan Kes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
58
run.sh
Normal file
58
run.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
# return true if local npm package is installed at ./node_modules, else false
|
||||
# example
|
||||
# echo "gulpacular : $(npm_package_is_installed gulpacular)"
|
||||
function npm_package_is_installed {
|
||||
# set to true initially
|
||||
local return_=true
|
||||
# set to false if not found
|
||||
ls node_modules | grep $1 >/dev/null 2>&1 || { local return_=false; }
|
||||
# return value
|
||||
echo "$return_"
|
||||
}
|
||||
|
||||
# First make sure surge is installed
|
||||
if ! type gulp &> /dev/null ; then
|
||||
# Check if it is in repo
|
||||
if ! $(npm_package_is_installed surge) ; then
|
||||
info "surge not installed, trying to install it through npm"
|
||||
|
||||
if ! type npm &> /dev/null ; then
|
||||
fail "npm not found, make sure you have npm or surge installed"
|
||||
else
|
||||
info "npm is available"
|
||||
debug "npm version: $(npm --version)"
|
||||
|
||||
info "installing surge"
|
||||
npm config set ca "" --silent
|
||||
sudo npm install npm -g --silent
|
||||
sudo npm install -g --silent gulp
|
||||
gulp_command="surge"
|
||||
fi
|
||||
else
|
||||
info "surge is available locally"
|
||||
debug "surge version: $( node ./node_modules/.bin/surge --version)"
|
||||
surge_command=" node ./node_modules/.bin/surge"
|
||||
fi
|
||||
else
|
||||
info "surge is available"
|
||||
debug "surge version: $(surge --version)"
|
||||
surge_command="surge"
|
||||
fi
|
||||
|
||||
debug "$surge_command"
|
||||
|
||||
set +e
|
||||
$surge_command
|
||||
result="$?"
|
||||
set -e
|
||||
|
||||
# Fail if it is not a success or warning
|
||||
if [[ result -ne 0 && result -ne 6 ]]
|
||||
then
|
||||
warn "$result"
|
||||
fail "surge command failed"
|
||||
else
|
||||
success "finished $surge_command"
|
||||
fi
|
20
wercker-step.yml
Normal file
20
wercker-step.yml
Normal file
@ -0,0 +1,20 @@
|
||||
name: surge-deploy
|
||||
version: 0.1.0
|
||||
description: Deploys a directory to surge.sh.
|
||||
keywords:
|
||||
- deploy
|
||||
- surge.sh
|
||||
properties:
|
||||
surge_login:
|
||||
type: string
|
||||
required: true
|
||||
directory:
|
||||
type: string
|
||||
default: public
|
||||
required: true
|
||||
token:
|
||||
type: string
|
||||
required: true
|
||||
domain:
|
||||
type: string
|
||||
required: true
|
Loading…
Reference in New Issue
Block a user