Update aws-sam-cicd.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 freeze > requirements.txt | |
- name: Install 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' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests with pytest | |
run: pytest | |
cd: | |
needs: ci | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create template.yml | |
run: echo "${{ secrets.AWS_SAM_TEMPLATE_YAML }}" > 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 | |
- name: Deploy with SAM | |
run: sam sync --stack-name=ome-restaurant-app |