name: namegen5 kind: pipeline type: docker steps: - name: download-samples image: docker:git commands: - git clone https://git.aiterp.net/namegen5/samples - name: compile-samples image: rust:1.63.0-slim depends_on: [download-samples] environment: SOURCE_DIR: ../samples DESTINATION_DIR: output/ commands: - cd compiler - mkdir output/ - cargo run --release - name: lambda-build image: rust:1.63.0-slim depends_on: [compile-samples] commands: - cd ./src/rust/namegen-lambda - apt-get update - apt-get install -y python3-pip zip - python3 -m pip install --upgrade pip - python3 -m pip install cargo-lambda - cargo lambda build --release - cd ./target/lambda/namegen_lambda - ls -lh ../../../../../../ - cp ../../../../../../compiler/output/_combined.json names.json - zip ../../../../../../code.zip * - name: website-build image: node:14.14.0 depends_on: [compile-samples] environment: DEBIAN_FRONTEND: noninteractive commands: - apt-get update - apt-get install -y --no-install-recommends build-essential ca-certificates curl git ssh libssl-dev - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --no-modify-path - . $HOME/.cargo/env - npm install - npm run export - mkdir __sapper__/export/assets - cp __sapper__/build/server/assets/*.wasm __sapper__/export/assets/ - name: website-deploy image: amazon/aws-cli:latest depends_on: - website-build - lambda-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 CF_DISTRIBUTION_ID: from_secret: cf_distribution_id commands: - cd __sapper__/export - aws s3 sync --delete . s3://$S3_WEBUI_BUCKET - aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*" - aws lambda update-function-code --function-name namegen_lambda --zip-file fileb://code.zip