-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.69 KB
/
aws-sam-cicd.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
name: aws-sam-cicd
on:
push:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python 3
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Update pip
run: python -m pip install --upgrade pip
- name: Freeze dependencies
run: pip install -r requirements.txt
- name: Commit and push changes
run: |
git config --global user.name KarmaPol
git config --global user.email [email protected]
git add requirements.txt
git commit -m 'Chore: Update requirements.txt' || true
git push || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: run pytest
run: pytest
cd:
needs: ci
runs-on: ubuntu-latest
steps:
- name: Create template.yml
run: echo "${{ secrets.AWS_SAM_TEMPLATE_YAML }}" > ${{ github.workspace }}/template.yml
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.9
- uses: aws-actions/setup-sam@v2
- 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 }}
aws-region: ap-northeast-2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- run: sam build --template-file template.yml
- run: sam deploy --no-fail-on-empty-changeset --stack-name ome-restaurant-app --template-file ${{ github.workspace }}/template.yml