-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ru Chern Chong
committed
May 3, 2024
1 parent
e58daa1
commit 3f416c1
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Deploy to AWS Lambda | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: Preview | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install AWS CLI | ||
run: | | ||
sudo apt-get install -y awscli | ||
- name: Configure AWS credentials | ||
run: | | ||
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws configure set region ${{ env.AWS_REGION }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Package application | ||
run: | | ||
zip -r deployment_package.zip . | ||
- name: Deploy to AWS Lambda - Production | ||
if: env.ENVIRONMENT == 'Production' | ||
run: | | ||
aws lambda update-function-code --function-name prod-lta-datasets-updater --zip-file fileb://deployment_package.zip | ||
- name: Deploy to AWS Lambda - Preview | ||
if: env.ENVIRONMENT == 'Preview' | ||
run: | | ||
aws lambda update-function-code --function-name dev-lta-datasets-updater --zip-file fileb://deployment_package.zip |