-
-
Save mohemohe/880cf3f67b421e0a9d47a523bab11f5e to your computer and use it in GitHub Desktop.
SAMメモ
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
.PHONY: deps statik build clean | |
deps: | |
go get github.com/rakyll/statik | |
statik: | |
${GOPATH}/bin/statik | |
build: | |
GOOS=linux GOARCH=amd64 go build -o app . | |
clean: | |
rm -f app |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
test | |
Sample SAM Template for test | |
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst | |
Globals: | |
Api: | |
BinaryMediaTypes: | |
- "*/*" | |
Function: | |
Timeout: 10 | |
Resources: | |
Function: | |
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction | |
Properties: | |
CodeUri: ./ | |
Handler: app | |
Runtime: go1.x | |
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html | |
Events: | |
CatchAll: | |
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api | |
Properties: | |
Path: /{proxy+} | |
Method: ANY | |
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object | |
Variables: | |
DUMMY_KEY: DUMMY_VAL | |
Outputs: | |
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function | |
# Find out more about other implicit resources you can reference within SAM | |
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api | |
API: | |
Description: "API Gateway endpoint URL for Prod environment for Function" | |
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" | |
Function: | |
Description: "Function Lambda Function ARN" | |
Value: !GetAtt Function.Arn | |
FunctionIamRole: | |
Description: "Implicit IAM Role created for function" | |
Value: !GetAtt FunctionRole.Arn |
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
name: deploy | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- uses: actions/setup-go@v1 | |
with: | |
go-version: 1.13 | |
- name: setup env | |
run: | | |
echo "::set-env name=GOPATH::$(go env GOPATH)" | |
echo "::add-path::$(go env GOPATH)/bin" | |
shell: bash | |
- uses: actions/cache@v1 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.yarn | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- uses: actions/cache@v1 | |
env: | |
cache-name: cache-go-modules | |
with: | |
path: ~/.go | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: yarn | |
working-directory: ./client | |
- run: yarn build:dev | |
working-directory: ./client | |
- run: make deps | |
working-directory: ./server | |
- run: make statik | |
working-directory: ./server | |
- run: make build | |
working-directory: ./server | |
- uses: mohemohe/sam-deploy-action@v1.1 | |
env: | |
TEMPLATE: ./server/template.yaml | |
AWS_STACK_NAME: changeme-stack-name | |
AWS_REGION: ap-northeast-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEPLOY_BUCKET: ${{ secrets.DEV_AWS_DEPLOY_BUCKET }} | |
FORCE_UPLOAD: true | |
- uses: jakejarvis/s3-sync-action@v0.5.1 | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.DEV_AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-northeast-1 | |
SOURCE_DIR: ./client/dist/ | |
- uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.DEV_CLOUDFLARE_ZONE }} | |
CLOUDFLARE_TOKEN: ${{ secrets.DEV_CLOUDFLARE_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment