-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 2.11 KB
/
test.yaml
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
69
70
71
72
73
74
75
name: Deploy applicatioin
on:
push:
branches:
- development
- main
pull_request:
branches:
- development
- main
jobs:
deploy:
if: contains(fromJson('["refs/heads/main", "refs/heads/production", "refs/heads/development"]'), github.ref)
runs-on: ubuntu-latest
name: Deploy application
# needs: test
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE}}
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: false
- name: Create Env file
run: |
touch .env
echo DATABASE_URL=$DATABASE_URL >> .env
echo MONGODB_DATABASE=$MONGODB_DATABASE >> .env
cat .env
- name: Upload .env as artifact
uses: actions/upload-artifact@v3
with:
name: env-vars
path: .env
- name: Source env file
run: |
source .env
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: false
- name: Build, tag, and push the image to Amazon ECR
id: build-image
run: |
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 537124948018.dkr.ecr.us-east-1.amazonaws.com
docker build -t ashdeck .
docker tag ashdeck:latest 537124948018.dkr.ecr.us-east-1.amazonaws.com/ashdeck:latest
docker push 537124948018.dkr.ecr.us-east-1.amazonaws.com/ashdeck:latest
# - name: Update lambda function
# id: update-lambda
# run: |
# aws lambda update-function-code --function-name aichtbot-container-dev --image-uri 537124948018.dkr.ecr.us-east-1.amazonaws.com/ashdeck:latest