Skip to content

T3 - Fix SAM Workflow - Doesn't break pipline with no changes #34

T3 - Fix SAM Workflow - Doesn't break pipline with no changes

T3 - Fix SAM Workflow - Doesn't break pipline with no changes #34

Workflow file for this run

name: 'SAM'
on:
push:
branches: [ "main" ]
pull_request:
permissions:
contents: read
jobs:
sam:
name: 'SAM'
runs-on: ubuntu-latest
environment: production
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest. Also, set the working directory to the `infra` folder.
defaults:
run:
shell: bash
working-directory: ./infra
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v4
# Install the latest version of AWS SAM CLI
- name: Setup AWS SAM
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install aws-sam-cli
# Set up the AWS CLI with the default configuration
- name: Set up AWS CLI
run: aws configure set region us-east-1
# Checks that all SAM configuration files adhere to a canonical format
- name: SAM Validate
run: sam validate --config-file samconfig.toml --region us-east-1
# Build the SAM application
- name: SAM Build
run: sam build -m ../package.json
# Deploy the SAM application
- name: SAM Deploy
run: |
sam deploy --config-file samconfig.toml --region us-east-1 --no-confirm-changeset
if [ $? -eq 1 ]; then
echo "No changes to deploy"
else
exit 1
fi