generated from csc301-fall-2021/deliverable-documents
-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (59 loc) · 2.43 KB
/
deploy_backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Deploy Backend
on:
workflow_dispatch:
jobs:
deploy_backend:
name: Upload to Lambda
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
role-duration-seconds: 1200
aws-region: us-east-1
- name: Upload to DispatchJob
run: |
cd $GITHUB_WORKSPACE/lambda/DispatchJob/payload
npm ci
zip -r DispatchJobPayload.zip *
aws lambda update-function-code --function-name DispatchJob --zip-file fileb://DispatchJobPayload.zip
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# - name: Upload to RunJob
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# run: |
# cd $GITHUB_WORKSPACE/lambda/RunJob
# docker build -t $ECR_REGISTRY/runjob_ecr_repo:latest .
# docker push $ECR_REGISTRY/runjob_ecr_repo:latest
# aws lambda update-function-code --function-name RunJob --image-uri $ECR_REGISTRY/runjob_ecr_repo@$(aws ecr describe-images --repository-name runjob_ecr_repo --filter tagStatus=TAGGED | jq -r .imageDetails[0].imageDigest)
- name: Upload to UpdateJobStatus
run: |
cd $GITHUB_WORKSPACE/lambda/UpdateJobStatus/payload
npm ci
zip -r UpdateJobStatusPayload.zip *
aws lambda update-function-code --function-name UpdateJobStatus --zip-file fileb://UpdateJobStatusPayload.zip
- name: Upload to QueryJob
run: |
cd $GITHUB_WORKSPACE/lambda/QueryJob/payload
npm ci
zip -r QueryJobPayload.zip *
aws lambda update-function-code --function-name QueryJob --zip-file fileb://QueryJobPayload.zip
- name: Upload to QueryUserPastJobs
run: |
cd $GITHUB_WORKSPACE/lambda/QueryUserPastJobs/payload
npm ci
zip -r QueryUserPastJobsPayload.zip *
aws lambda update-function-code --function-name QueryUserPastJobs --zip-file fileb://QueryUserPastJobsPayload.zip