-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from hatchboxio/deploy-sha
Use GitHub SHA to deploy on Hatchbox v2
- Loading branch information
Showing
4 changed files
with
55 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### v2 | ||
|
||
* Drop Hatchbox Classic support | ||
* Deploy using ${{ github.sha }} instead of latest branch commit | ||
* Include response in GitHub Action outputs | ||
* Raise error on failure | ||
|
||
### v1 | ||
|
||
* Trigger deployments in Hatchbox.io and Hatchbox Classic |
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
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,25 +1,23 @@ | ||
name: 'Hatchbox Deploy Action' | ||
description: 'Send deployment notifications to the Hatchbox API' | ||
name: 'Hatchbox.io Deploy Action' | ||
description: 'Send deployment notifications to the Hatchbox.io API' | ||
branding: | ||
icon: 'globe' | ||
color: 'red' | ||
inputs: | ||
deploy_key: | ||
description: 'The Hatchbox project deploy key' | ||
description: 'Your Hatchbox.io app's Deploy Key.' | ||
required: true | ||
branch: | ||
description: 'The branch that needs to be deployed' | ||
sha: | ||
description: 'The commit sha to be deployed.' | ||
required: false | ||
default: 'master' | ||
classic: | ||
description: 'If hatchbox classic is used' | ||
required: false | ||
default: 'false' | ||
default: ${{ github.sha }} | ||
outputs: | ||
response: | ||
description: "JSON response for the Hatchbox.io deployment" | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.deploy_key }} | ||
- ${{ inputs.branch }} | ||
- ${{ inputs.classic }} | ||
- ${{ inputs.sha }} |
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,12 +1,7 @@ | ||
#!/bin/sh -l | ||
|
||
set -x | ||
set -xe | ||
|
||
if [[ $INPUT_CLASSIC == "true" ]]; then | ||
url="https://classic.hatchbox.io/webhooks/custom/push/$INPUT_DEPLOY_KEY?ref=refs%2Fheads%2F$INPUT_BRANCH" | ||
else | ||
url="https://app.hatchbox.io/webhooks/deployments/$INPUT_DEPLOY_KEY?latest=true" | ||
fi | ||
|
||
curl -X POST --fail $url | ||
echo "Success" | ||
response=curl -X POST --fail-with-body "https://app.hatchbox.io/webhooks/deployments/$INPUT_DEPLOY_KEY?sha=$INPUT_SHA" | ||
echo "response=$response" >> $GITHUB_OUTPUT | ||
echo "Deployment has started on Hatchbox.io" |