Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
name: Deploy to AWS Lambda
run-name: Deploy to ${{ inputs.environment }} triggered by @${{ github.actor }}

on:
workflow_dispatch:

inputs:
environment:
description: "Environment for deployment"
required: true
default: "dev"
type: choice
options:
- dev
- prod

env:
AWS_REGION: "us-east-1"
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
ENV: ${{ inputs.environment }}

jobs:
deploy:
Expand All @@ -15,6 +25,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Restrict production deployments to main branch
if: ${{ inputs.environment == 'prod' && github.ref != 'refs/heads/main' }}
run: |
echo "❌ Production deployment is only allowed from the main branch."
exit 1

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
Expand All @@ -40,6 +56,6 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Deploy to dev
- name: Deploy to environment
run: |
serverless deploy --stage dev
serverless deploy --stage $ENV
Loading