From 097c00dd87c646fb43673e4777dea9fde441a31d Mon Sep 17 00:00:00 2001 From: Jake Hobbs Date: Thu, 18 Jan 2024 22:18:08 -0800 Subject: [PATCH] add email subject & service deploy action --- .github/workflows/main.yml | 17 ++++++++++++++++- service/Dockerfile | 10 ++++++++++ service/main.go | 5 +++-- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 service/Dockerfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index acd8e44..76a5868 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: - main jobs: - deploy: + deploy_frontend: runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -45,3 +45,18 @@ jobs: AWS_REGION: "us-west-2" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + deploy_service: + runs-on: ubuntu-latest + if: "github.event_name == 'push' && github.event_path == 'service'" + steps: + - uses: actions/checkout@v2 + - run: cd service + - name: Build image & push to ECR + uses: kciter/aws-ecr-action@master + with: + access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + account_id: ${{ secrets.AWS_ACCOUNT_ID }} + repo: dxe/helptheducks-service + region: us-west-2 + tags: latest,${{ github.sha }} diff --git a/service/Dockerfile b/service/Dockerfile new file mode 100644 index 0000000..9b50190 --- /dev/null +++ b/service/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.21.6-alpine AS builder +RUN mkdir /app +ADD . /app +WORKDIR /app +RUN go build -o service . + +FROM alpine:latest +RUN apk add --no-cache ca-certificates tzdata +COPY --from=builder /app/service /service +ENTRYPOINT ["./service"] \ No newline at end of file diff --git a/service/main.go b/service/main.go index d03a91e..4edb8b5 100644 --- a/service/main.go +++ b/service/main.go @@ -78,8 +78,9 @@ func processNewMessages() { err := mailer.Send(mailClient, mailer.SendOptions{ From: fmt.Sprintf("%s <%s>", message.Name, fromEmail), ReplyTo: message.Email, - To: "jake@directactioneverywhere.com", // TODO - Subject: "Testing email", // TODO + // TODO: change this after confirming everything is working okay + To: "jake@directactioneverywhere.com", + Subject: "Prosecute Reichardt Duck Farm for Animal Abuse", Body: message.Message, }) if err != nil {