version: 0.2 phases: install: runtime-versions: golang: 1.13 nodejs: 10 commands: - export GO111MODULE="on" - go get -u golang.org/x/lint/golint pre_build: commands: #----------------------------- API ----------------------------# - cd appbackend # Fetch all dependencies - go get -t - cd .. build: commands: # Build our go application - cd appbackend - go build - cd .. - cd appfrontend - codebuildid="$(echo $CODEBUILD_BUILD_ID | cut -d':' -f2)" - echo $codebuildid - aws s3 cp --recursive . s3:///$codebuildid/frontend/ - cd .. - aws cloudformation package --template-file template.yaml --s3-bucket --s3-prefix $codebuildid --output-template-file packaged.yaml post_build: commands: - echo "SAM packaging completed on `date`" - echo $CODEBUILD_SOURCE_VERSION - echo $CODEBUILD_WEBHOOK_TRIGGER - echo $CODEBUILD_BUILD_ID - echo $CODEBUILD_WEBHOOK_EVENT - now=$(date) - echo $now - | aws dynamodb put-item \ --table-name \ --item '{"tag": {"S":"'"$CODEBUILD_WEBHOOK_TRIGGER"'"},"commitid": {"S":"'"$CODEBUILD_SOURCE_VERSION"'"},"buildid": {"S":"'"$CODEBUILD_BUILD_ID"'"},"timestamp": {"S":"'"$now"'"}}' \ artifacts: files: - packaged.yaml discard-paths: yes secondary-artifacts: nodejs_artifacts: base-directory: frontend files: - '**/*'