Files
Sunscreen/.github/workflows/playground.yml
2022-05-16 16:09:07 -07:00

50 lines
1.6 KiB
YAML

name: playground
on:
push:
branches: [ playground ]
env:
CARGO_TERM_COLOR: always
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust-playground/deployment/target
rust-playground/ui/target
rust-playground/ui/frontend/node_modules
key: ${{ runner.os }}-cargo-playground-${{ hashFiles('rust-playground/ui/Cargo.lock') }}-${{ hashFiles('rust-playground/ui/frontend/yarn.lock') }}-${{ hashFiles('rust-playground/deployment/Cargo.lock') }}
- name: Yarn install
run: yarn install
working-directory: ./rust-playground/ui/frontend
- name: Yarn build
run: yarn build
working-directory: ./rust-playground/ui/frontend
- name: Cargo build
run: cargo build --release --verbose
working-directory: ./rust-playground/ui
- name: Build deployment app
run: cargo build --release --verbose
working-directory: ./rust-playground/deployment
- name: Create EC2 instance
run: ./target/release/deployment
working-directory: ./rust-playground/deployment
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYMENT_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYMENT_AWS_ACCESS_KEY_SECRET }}
EC2_KEY_PAIR: Deployment
EC2_SECRET_KEY: ${{ secrets.DEPLOYMENT_KEYPAIR_SECRET_KEY }}
RUST_LOG: info