Skip to content

Commit 0635d3a

Browse files
committed
Refines input yml and adds validation build.
1 parent a7946e4 commit 0635d3a

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
# s3put
22

3-
Upload a file to a s3 bucket.
3+
[Wercker] step to upload a file to [Amazon S3].
44

55
You can use application and deployment variables in wercker.
66

7-
View this step in the [wercker directory](#TODO)
7+
View this step in the [wercker directory][wd]
88

99
Current status on wercker:
1010

11-
TODO
11+
[![wercker status](https://app.wercker.com/status/576477b5c41a585aa848dbcc6bfe58f9/m "wercker status")](https://app.wercker.com/project/bykey/576477b5c41a585aa848dbcc6bfe58f9)
1212

1313
## Options
1414

1515
* `key-id` (required) The Amazon Access key that will be used for authorization.
1616
* `key-secret` (required) The Amazon Access secret that will be used for authorization.
17-
* `bucket-url` (required) The url of the bucket to sync to, like: `s3://born2code.net`
18-
* `source-file` (required) The local file to upload to s3.
19-
* `dest-file` (required) The name of the file to upload to.
17+
* `url` (required) The S3 URL denoting the file's destination.
18+
* `file` (required) The name of the file to upload to.
2019

2120
## Example
2221

2322
- s3put:
2423
key-id: $KEY
2524
key-secret: $SECRET
26-
bucket-url: $BUCKET
27-
source-file: myproject-0.1.0.tar.gz
28-
dest-file: myproject-latest.tar.gz
25+
file: myproject-0.1.0.tar.gz
26+
url: s3://mybucket/myproject-latest.tar.gz
27+
28+
[Wercker]: http://wercker.com
29+
[Amazon S3]: http://aws.amazon.com/s3
30+
[wd]: https://app.wercker.com/#applications/5290b7c2f0bb53d73e00a03c/tab/details

run.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@ then
1111
fail 'missing or empty option key_secret, please check wercker.yml'
1212
fi
1313

14-
if [ ! -n "$WERCKER_S3PUT_BUCKET_URL" ]
14+
if [ ! -n "$WERCKER_S3PUT_URL" ]
1515
then
1616
fail 'missing or empty option bucket_url, please check wercker.yml'
1717
fi
1818

19-
if [ ! -n "$WERCKER_S3PUT_SOURCE_FILE" ]
19+
if [ ! -n "$WERCKER_S3PUT_FILE" ]
2020
then
2121
fail 'missing or empty option source_file, please check wercker.yml'
2222
fi
2323

24-
if [ ! -n "$WERCKER_S3PUT_DEST_FILE" ]
25-
then
26-
fail 'missing or empty option dest_file, please check wercker.yml'
27-
fi
2824

2925
if ! type s3cmd &> /dev/null ;
3026
then
@@ -48,16 +44,13 @@ echo "access_key=$WERCKER_S3PUT_KEY_ID" >> .s3cfg
4844
echo "secret_key=$WERCKER_S3PUT_KEY_SECRET" >> .s3cfg
4945
debug "generated .s3cfg for key $WERCKER_S3PUT_KEY_ID"
5046

51-
source_file="$WERCKER_ROOT/$WERCKER_S3PUT_SOURCE_FILE"
52-
dest_file="$WERCKER_S3PUT_BUCKET_URL/$WERCKER_S3PUT_DEST_FILE"
53-
5447
info 'starting s3 upload'
5548

5649
# TODO make public an option
5750

5851
set +e
59-
debug "s3cmd put --acl-public --verbose '$source_file' '$dest_file'"
60-
sync_output=$(s3cmd sync --acl-public --verbose "$source_file" "$dest_file")
52+
debug "s3cmd put --acl-public --verbose '$WERCKER_S3PUT_FILE' '$WERCKER_S3PUT_URL'"
53+
sync_output=$(s3cmd put --acl-public --verbose "$WERCKER_S3PUT_FILE" "$WERCKER_S3PUT_URL")
6154

6255
if [[ $? -ne 0 ]];then
6356
warning $sync_output

wercker-step.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name: s3put
2-
version: 0.0.1
2+
version: 0.0.2
33
description: s3put step

wercker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
box: default
2+
build:
3+
steps:
4+
- validate-wercker-step

0 commit comments

Comments
 (0)