Skip to content

Add aws deployment (#7) #31

Add aws deployment (#7)

Add aws deployment (#7) #31

name: ci
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# It is important to install java before installing clojure tools which needs java
# exclusions: babashka, clj-kondo and cljstyle
- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "12"
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@13.0
with:
# Install just one or all simultaneously
# The value must indicate a particular version of the tool, or use 'latest'
# to always provision the latest version
cli: 1.11.4.1474 # Clojure CLI based on tools.deps
bb: 1.3.191 # Babashka
clj-kondo: 2024.08.01 # Clj-kondo
- name: linting
run: clj-kondo --lint src
- name: unit tests
run: bb test
docker:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: cwithmichael/whatcanueat:latest
aws:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install CDK
run: npm install -g aws-cdk
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: "us-east-1"
- name: Deploy to AWS
working-directory: ./deployment
run: cdk deploy --require-approval=never