Skip to content

Commit

Permalink
aws/sam: add username SAM and example
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 20, 2018
1 parent 5aada34 commit 6fbd775
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

[GitHub Actions](https://github.com/features/actions) for automating builds, deployments, and so on.

- [Up](./up) — Deploy serverless applications and APIs to AWS Lambda
- [Up](./up) — Deploy serverless applications and APIs to [AWS Lambda](https://aws.amazon.com/lambda/)
- [Go](./go) — Build Go applications
- [Slack](./slack) — Send Slack messages
- [AWS SAM](./aws/sam) — Deploy serverless infrastructure with [AWS SAM](https://aws.amazon.com/serverless/sam/)

## Resources

Expand Down
42 changes: 42 additions & 0 deletions aws/sam/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,45 @@ See the [AWS Security Credentials](https://docs.aws.amazon.com/general/latest/gr

- `AWS_DEFAULT_REGION`- **Optional** The AWS region name, defaults to `us-east-1` ([more info](https://docs.aws.amazon.com/general/latest/gr/rande.html))
- `AWS_DEFAULT_OUTPUT`- **Optional** The CLI's output output format, defaults to `json` ([more info](https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html))

## Example

Package and deploy AWS SAM application with Slack notifications:

```hcl
workflow "Deployment" {
on = "push"
resolves = ["Deploy Notification"]
}
action "Build" {
uses = "apex/actions/aws/sam@master"
secrets = ["AWS_SECRET_ACCESS_KEY", "AWS_ACCESS_KEY_ID"]
args = "package --template-file template.yml --output-template-file out.yml --s3-bucket my-bucket-name"
}
action "Build Notification" {
needs = "Build"
uses = "apex/actions/[email protected]"
secrets = ["SLACK_WEBHOOK_URL"]
}
action "Deploy" {
needs = "Build Notification"
uses = "apex/actions/aws/sam@master"
secrets = ["AWS_SECRET_ACCESS_KEY", "AWS_ACCESS_KEY_ID"]
args = "deploy --stack-name myapp --capabilities CAPABILITY_IAM --template-file out.yml"
env = {
AWS_DEFAULT_REGION = "us-west-2"
}
}
action "Deploy Notification" {
needs = "Deploy"
uses = "apex/actions/[email protected]"
}
```

## Notes

This action generates a Slack message upon deployment.
1 change: 1 addition & 0 deletions aws/sam/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ footer="Completed in ${duration}s"

cat <<EOF > slack.json
{
"username": "SAM",
"icon_url": "$icon",
"attachments": [
{
Expand Down
4 changes: 2 additions & 2 deletions go/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GitHub Action for using the `go` binary. `GO111MODULE` is enabled and encouraged

Deploy an application to `production` after building the Go binary. By default `./server` is built from `*.go` files, so if you Go source is in root this should work great!

```
```hcl
workflow "Deployment" {
on = "push"
resolves = ["Deploy"]
Expand All @@ -26,7 +26,7 @@ action "Deploy" {

Alternatively you can specify the build command:

```
```hcl
workflow "Deployment" {
on = "push"
resolves = ["Deploy"]
Expand Down
2 changes: 1 addition & 1 deletion slack/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GitHub Action for sending Slack messages which were defined by previous action(s
This example sends a Slack notification after a deployment is complete. The `apex/actions/up`
action generates a slack.json to provide a message.

```
```hcl
workflow "Deployment" {
on = "push"
resolves = ["Deploy Notification"]
Expand Down
2 changes: 1 addition & 1 deletion up/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Deploy an application to `production` after installing NPM dependencies
in a separate action, note that Up's build hooks are disabled here with `--no-build` since
we have already built the application.

```
```hcl
workflow "Deploy Application" {
on = "push"
resolves = ["Deploy"]
Expand Down

0 comments on commit 6fbd775

Please sign in to comment.