Initial commit

Co-authored-by: Nick Van Wiggeren <nickvanw@github.com>
Co-authored-by: Thomas Osowski <osowskit@github.com>
Co-authored-by: Nick Van Wiggeren <nickvanw@users.noreply.github.com>
Co-authored-by: Max Schoening <max@max.wtf>
Co-authored-by: Steve Winton <stevewinton@gmail.com>
Co-authored-by: Tom Osowski <osowskit@github.com>
Co-authored-by: Brandon Keepers <bkeepers@github.com>
Co-authored-by: Max Schoening <max@github.com>
Co-authored-by: Steve Winton <swinton@users.noreply.github.com>
Co-authored-by: Guðmundur Bjarni Ólafsson <gudmundur@github.com>
Co-authored-by: Mike Coutermarsh <mscoutermarsh@github.com>
This commit is contained in:
GitHub
2018-10-16 07:48:39 -07:00
committed by Brandon Keepers
commit 072b73f323
12 changed files with 1739 additions and 0 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
# ignore all files by default
*
# include required files with an exception
!entrypoint.sh
!LICENSE
!README.md
!THIRD_PARTY_NOTICE.md

49
.github/main.workflow vendored Normal file
View File

@@ -0,0 +1,49 @@
workflow "Build and Publish" {
on = "push"
resolves = "Docker Publish"
}
action "Shell Lint" {
uses = "actions/bin/shellcheck@master"
args = "entrypoint.sh"
}
action "Test" {
uses = "actions/bin/bats@master"
args = "test/*.bats"
}
action "Docker Lint" {
uses = "docker://replicated/dockerfilelint"
args = ["Dockerfile"]
}
action "Build" {
needs = ["Shell Lint", "Test", "Docker Lint"]
uses = "actions/docker/cli@master"
args = "build -t heroku ."
}
action "Docker Tag" {
needs = ["Build"]
uses = "actions/docker/tag@master"
args = "heroku github/heroku --no-latest"
}
action "Publish Filter" {
needs = ["Build"]
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Docker Login" {
needs = ["Publish Filter"]
uses = "actions/docker/login@master"
secrets = ["DOCKER_USERNAME", "DOCKER_PASSWORD"]
}
action "Docker Publish" {
needs = ["Docker Tag", "Docker Login"]
uses = "actions/docker/cli@master"
args = "push github/heroku"
}

2
Brewfile Normal file
View File

@@ -0,0 +1,2 @@
brew "bats"
brew "shellcheck"

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM node:10-slim
LABEL version="1.0.0"
LABEL repository="http://github.com/actions/heroku"
LABEL homepage="http://github.com/actions/heroku"
LABEL maintainer="GitHub Actions <support+actions@github.com>"
LABEL "com.github.actions.name"="GitHub Action for Heroku"
LABEL "com.github.actions.description"="Wraps the Heroku CLI to enable common Heroku commands."
LABEL "com.github.actions.icon"="upload-cloud"
LABEL "com.github.actions.color"="purple"
COPY LICENSE README.md THIRD_PARTY_NOTICE.md /
ENV DOCKERVERSION=18.06.1-ce
RUN apt-get update && apt-get -y --no-install-recommends install curl \
&& curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz \
&& rm -rf /var/lib/apt/lists/* \
&& yarn global add heroku
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

22
LICENSE Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2018 GitHub, Inc. and contributors
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.

48
README.md Normal file
View File

@@ -0,0 +1,48 @@
# GitHub Deployer for Heroku
The GitHub Deployer for [Heroku](https://heroku.com/) task wraps the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) to enable common Heroku commands.
## Usage
An example workflow to build a docker container from source and push and release the image to an existing application on Heroku:
```
workflow "Deploy to Heroku" {
on = "push"
resolves = "release"
}
action "login" {
uses = "actions/heroku@master"
args = "container:login"
secrets = ["HEROKU_API_KEY"]
}
action "push" {
uses = "actions/heroku@master"
needs = "login"
args = "container:push -a calm-fortress-1234 web"
secrets = ["HEROKU_API_KEY"]
}
action "release" {
uses = "actions/heroku@master"
needs = "push"
args = "container:release -a calm-fortress-1234 web"
secrets = ["HEROKU_API_KEY"]
}
```
### Secrets
* `HEROKU_API_KEY` - **Required**. The token to use for authentication with the Heroku API ([more info](https://help.heroku.com/PBGP6IDE/how-should-i-generate-an-api-key-that-allows-me-to-use-the-heroku-platform-api))
### Environment variables
* `HEROKU_APP` - **Optional**. To specify a Heroku application
## License
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).
Container images built with this project include third party materials. See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details.

1541
THIRD_PARTY_NOTICE.md Normal file

File diff suppressed because it is too large Load Diff

5
entrypoint.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
sh -c "heroku $*"

15
script/bootstrap Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# script/bootstrap: Resolve dependencies that the application requires to run.
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi

10
script/test Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
bats test/*.bats
shellcheck *.sh

2
test/bin/heroku Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
echo "Simulate Docker"

14
test/entrypoint.bats Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bats
PATH="$PATH:$BATS_TEST_DIRNAME/bin"
function setup() {
# Ensure GITHUB_WORKSPACE is set
export GITHUB_WORKSPACE="${GITHUB_WORKSPACE-"${BATS_TEST_DIRNAME}/.."}"
}
@test "entrypoint runs successfully" {
run $GITHUB_WORKSPACE/entrypoint.sh help
echo "$output"
[ "$status" -eq 0 ]
}