name: lektura-red kind: pipeline type: docker steps: - name: backend-build image: golang:1.15 depends_on: [] commands: - go mod download - CGO_ENABLED=0 go build -ldflags "-w -s" -o build/api/handler cmd/stufflog2-lambda/main.go - name: backend-test image: golang:1.15 depends_on: [] commands: - go test -v ./... - name: backend-migrate image: golang:1.15 depends_on: [] environment: DB_CONNECT: from_secret: db_connect commands: - go get -u github.com/pressly/goose/... - cd migrations/postgres - goose postgres "$DB_CONNECT" up - name: backend-deploy image: node:14.14.0 depends_on: - backend-build - backend-test - backend-migrate environment: AWS_ACCESS_KEY_ID: from_secret: aws_access_key_id AWS_SECRET_ACCESS_KEY: from_secret: aws_secret_access_key AWS_DEFAULT_REGION: from_secret: aws_region AMI_ROLE: from_secret: ami_role S3_WEBUI_BUCKET: from_secret: s3_webui_bucket DOMAIN_NAME: from_secret: domain_name CERTIFICATE_NAME: from_secret: certificate_name CERTIFICATE_ARN: from_secret: certificate_arn HOSTED_ZONE_ID: from_secret: hosted_zone_id DB_DRIVER: from_secret: db_driver DB_CONNECT: from_secret: db_connect commands: - apt-get update > /dev/null 2>&1 - apt-get -y install awscli zip > /dev/null 2>&1 - npm install -g serverless > /dev/null 2>&1 - npm install -g serverless-domain-manager > /dev/null 2>&1 - npm install -g serverless-apigateway-service-proxy > /dev/null 2>&1 - serverless deploy - name: frontend-build image: node:14.14.0 depends_on: [] environment: AWS_AMPLIFY_REGION: from_secret: aws_region AWS_AMPLIFY_USER_POOL_ID: from_secret: aws_amplify_user_pool_id AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID: from_secret: aws_amplify_user_pool_web_client_id commands: - cd svelte-ui - echo AWS_AMPLIFY_USER_POOL_ID=$AWS_AMPLIFY_USER_POOL_ID > build.env - echo AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID=$AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID >> build.env - npm install - npm run build - name: frontend-deploy image: amazon/aws-cli:latest depends_on: - frontend-build environment: AWS_ACCESS_KEY_ID: from_secret: aws_access_key_id AWS_SECRET_ACCESS_KEY: from_secret: aws_secret_access_key AWS_DEFAULT_REGION: from_secret: aws_region S3_WEBUI_BUCKET: from_secret: s3_webui_bucket commands: - cd svelte-ui/public - aws s3 sync . s3://$S3_WEBUI_BUCKET