Skip to content

Commit

Permalink
updating foundations
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLiffen committed Jan 2, 2024
1 parent 08140f2 commit 27c7592
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Extract branch name
id: extract_branch
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Clean up Branch Name (Valid for CloudFormation Stack Name)
id: formatted_branch
env:
DATA: ${{ steps.extract_branch.outputs.branch }}
run: |
noSpecialChars="$(echo "$DATA" | sed 's/[^a-zA-Z0-9 ]//g')" # Removing any character apart from numbers letters and spaces
lowercase="$(echo "$noSpecialChars" | awk '{print tolower($0)}')" # Making Lowercase
lowercaseDashRepoName="$(echo ${lowercase// /-})" # Replacing spaces with dashses
if [ ${#lowercaseDashRepoName} -gt 100 ]; then
lowercaseDashRepoName=${lowercaseDashRepoName:0:100}
fi
echo "BRANCH=$(echo "$lowercaseDashRepoName")" >> "$GITHUB_OUTPUT"
- name: Setup Cloud Formation Linter with Latest Version
uses: scottbrenner/cfn-lint-action@v2
- name: Print the Cloud Formation Linter Version & Run Linter.
Expand All @@ -47,15 +69,5 @@ jobs:
npm cache clean --force
npm install
npm run build
- name: Extract branch name
id: extract_branch
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
echo "strippedBranchName=$(echo $branch | sed -e 's/\//-/g')" >> $GITHUB_OUTPUT
echo "finalBranch=${strippedBranchName:0:100}" >> $GITHUB_OUTPUT
echo $branch
echo $strippedBranchName
echo $finalBranch
- run: sam build --use-container
- run: sam deploy --debug --no-confirm-changeset --no-fail-on-empty-changeset --stack-name CodeScanningToSlackStack-${{ steps.extract_branch.outputs.finalBranch }} --capabilities CAPABILITY_IAM --region ${{ env.REGION }} --resolve-s3
- run: sam deploy --debug --no-confirm-changeset --no-fail-on-empty-changeset --stack-name CodeScanningToSlackStack-${{ steps.formatted_branch.outputs.BRANCH }} --capabilities CAPABILITY_IAM --region ${{ env.REGION }} --resolve-s3

0 comments on commit 27c7592

Please sign in to comment.