Skip to content

Add README to trigger workflow #2

Add README to trigger workflow

Add README to trigger workflow #2

Workflow file for this run

name: Deploy SAM Application
on:
push:
branches:
- main
paths:
- 'serverless-sam-app/**'
- '.github/workflows/deploy-sam.yml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install SAM CLI
run: |
pip install aws-sam-cli
sam --version
- name: Validate SAM template
run: |
cd serverless-sam-app
sam validate --template template.yaml
- name: Build SAM application
run: |
cd serverless-sam-app
sam build --template template.yaml
- name: Deploy SAM application
run: |
cd serverless-sam-app
sam deploy \
--template-file .aws-sam/build/template.yaml \
--stack-name joke-api-sam-stack \
--s3-bucket sam-deployments-${{ secrets.AWS_ACCOUNT_ID }} \
--s3-prefix joke-api-sam-stack \
--capabilities CAPABILITY_IAM \
--region ap-southeast-2 \
--no-fail-on-empty-changeset \
--no-confirm-changeset
- name: Get API Gateway URL
run: |
API_URL=$(aws cloudformation describe-stacks \
--stack-name joke-api-sam-stack \
--region ap-southeast-2 \
--query 'Stacks[0].Outputs[?OutputKey==`JokeApiUrl`].OutputValue' \
--output text)
echo "🚀 API Endpoint: $API_URL"
echo "📱 Test endpoints:"
echo " - $API_URL/"
echo " - $API_URL/joke"
echo " - $API_URL/health"