Skip to content

Commit

Permalink
Add action
Browse files Browse the repository at this point in the history
  • Loading branch information
behe committed Apr 24, 2021
0 parents commit 3314487
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Heroku Build"
description: "Upload release and trigger build on Heroku"
inputs:
app-name:
description: "Name of Heroku application"
required: true
api-key:
description: "API key with the deploy role"
required: true
path:
description: "Directory to upload"
required: false
default: "."
runs:
using: "composite"
steps:
- run: |
tar -czvf release.tgz --exclude .git ${{ inputs.path }}
ls -lh release.tgz
sources=`curl -v -X POST https://api.heroku.com/apps/${{ inputs.app-name }}/sources -H 'Accept: application/vnd.heroku+json; version=3' -H 'Authorization: Bearer ${{ inputs.api-key }}'`
echo $sources
get_url=`echo $(jq -r '.source_blob.get_url' <<< "$sources")`
echo $get_url
put_url=`echo $(jq -r '.source_blob.put_url' <<< "$sources")`
echo $put_url
curl -v $put_url -X PUT -H "Content-Type:" -H "Accept: application/vnd.heroku+json; version=3" --data-binary @release.tgz
curl -v -X POST https://api.heroku.com/apps/${{ inputs.app-name }}/builds -H 'Content-Type: application/json' -H 'Authorization: Bearer ${{ inputs.api-key }}' -H 'Accept: application/vnd.heroku+json; version=3' -d "{\"source_blob\":{\"url\":\"$get_url\",\"version\":\"`git rev-parse HEAD`\"}}"
shell: bash

0 comments on commit 3314487

Please sign in to comment.