-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc72010
commit 84bd195
Showing
3 changed files
with
62 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
# hekto-github-action | ||
Github action for Hekto CI/CD | ||
# Hekto Deployer | ||
Github action for Hekto CI/CD. | ||
|
||
This action prints "Hello World" or "Hello" + the name of a person to greet to the log. | ||
Automatic deployment of branches to Hekto. | ||
|
||
This action assumes that the application has already been prepared for deployment. Use this action after other actions that builds the application. | ||
|
||
## Inputs | ||
|
||
### `who-to-greet` | ||
### `token` | ||
|
||
**Required** Token for authorization. Can be found on your Hekto profile page. | ||
|
||
**Required** The name of the person to greet. Default `"World"`. | ||
### `source` | ||
|
||
## Outputs | ||
The source folder to deploy. Default `/`. | ||
|
||
### `time` | ||
### `url` | ||
|
||
The time we greeted you. | ||
For development purposes. Specifies what url the action should target. Default `https://hekto.app`. | ||
|
||
## Example usage | ||
|
||
uses: actions/hello-world-docker-action@v1 | ||
``` | ||
uses: standout/hekto-deployer@v1 | ||
with: | ||
who-to-greet: 'Mona the Octocat' | ||
token: 'ukBGtVBVk1uCEgZhayJkjxMsaBwM9H72dXe5ULW1AgFyTvBo' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
name: 'Hello World' | ||
description: 'Greet someone and record the time' | ||
name: 'Hekto Deployer' | ||
description: 'Deploy to Hekto' | ||
inputs: | ||
who-to-greet: # id of input | ||
description: 'Who to greet' | ||
token: | ||
description: 'token' | ||
required: true | ||
default: 'World' | ||
outputs: | ||
time: # id of output | ||
description: 'The time we greeted you' | ||
source: | ||
description: 'source' | ||
required: false | ||
default: './' | ||
url: | ||
description: 'url' | ||
reqired: false | ||
default: 'https://hekto.app' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.who-to-greet }} | ||
- ${{ inputs.token }} | ||
- ${{ inputs.source }} | ||
- ${{ inputs.url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
#!/bin/sh -l | ||
|
||
echo "Hello $1" | ||
time=$(date) | ||
echo "::set-output name=time::$time" | ||
echo "Token: $1" | ||
echo "Source: $2" | ||
echo "Url: $3" | ||
|
||
apk add curl | ||
apk add git | ||
apk add jq | ||
|
||
file_name="package.tar.gz" | ||
tar -zcvf $file_name $2 | ||
git_hash=$(git rev-parse --short "$GITHUB_SHA") | ||
file_size=$(stat -c%s "$file_name") | ||
|
||
echo $file_name | ||
echo $file_size | ||
echo $git_hash | ||
|
||
response=$(curl -X POST -d file_name=$file_name -d file_size=$file_size -d commit=$git_hash $3/sv/api/v1/deployment -H "Authorization: Bearer $1") | ||
|
||
echo $response > response.json | ||
url=$(jq -r '.url' response.json) | ||
deployment=$(jq -r '.deployment' response.json) | ||
|
||
echo $url | ||
echo $deployment | ||
|
||
s3_response=$(curl -T $file_name $url) | ||
echo $s3_response | ||
|
||
curl=$(curl -X PUT $3/sv/api/v1/deployment/$deployment -H "Authorization: Bearer $1") | ||
echo $curl |