Skip to content

Bump software.amazon.awssdk:apigatewaymanagementapi #18

Bump software.amazon.awssdk:apigatewaymanagementapi

Bump software.amazon.awssdk:apigatewaymanagementapi #18

Workflow file for this run

name: Deploy AWS Lambda
on:
push:
branches: [ main ]
paths: [ deploy/aws/** ]
jobs:
sam-deploy:
runs-on: ubuntu-latest
outputs:
env-name: ${{ steps.env-name.outputs.environment }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Configure AWS credentials
id: creds
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: ${{ secrets.AWS_REGION }}
- name: SAM Validate
run: sam validate --lint
working-directory: deploy/aws
- name: Configure variables
shell: bash
id: vars
env:
REPO: ${{ github.repository }}
HASH: ${{ github.sha }}
REF: ${{ github.ref }}
run: |
# Set variables
BRANCH=${REF#refs/heads/}
BRANCH=`echo $BRANCH | sed 's/[^a-z0-9.-]/-/g'`
REPOSITORY=`echo $REPO | cut -d'/' -f2`
ENVIRONMENT=$REPOSITORY-$BRANCH-${{ secrets.AWS_REGION }}
# In this step we are setting variables and persistenting them
# into the environment so that they can be utilized in other steps
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
echo "repository=$REPOSITORY" >> $GITHUB_OUTPUT
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
# Output variables to ensure their values are set correctly when ran
echo "The region is ${{ secrets.AWS_REGION }}"
echo "The repository is $REPOSITORY"
echo "The environment is $ENVIRONMENT"
echo "The branch is $BRANCH"
- name: Clear SAM outputs
run: yq eval 'del(.Outputs)' -i template.yaml
working-directory: deploy/aws
- name: SAM Build and Run Unit Tests
run: sam build --parallel
working-directory: deploy/aws
- name: SAM Deploy
run: |
# Create S3 Bucket to store code
aws s3api head-bucket --bucket "${{ steps.vars.outputs.environment }}" 2>/dev/null \
|| aws s3 mb s3://${{ steps.vars.outputs.environment }}
# Run SAM Deploy
sam deploy --template-file .aws-sam/build/template.yaml \
--stack-name ${{ steps.vars.outputs.environment }} \
--s3-bucket ${{ steps.vars.outputs.environment }} \
--parameter-overrides \
'ParameterKey=Version,ParameterValue=${{ steps.vars.outputs.version }}' \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
working-directory: deploy/aws