Skip to content

Merge pull request #1706 from Crown-Commercial-Service/dependabot/bun… #1099

Merge pull request #1706 from Crown-Commercial-Service/dependabot/bun…

Merge pull request #1706 from Crown-Commercial-Service/dependabot/bun… #1099

name: "Set up deployment of latest code to AWS"
on:
push:
branches:
- develop
- main
- preview
- production
jobs:
determine-environment:
runs-on: ubuntu-latest
outputs:
ENV_NAME: ${{ steps.determine_environment.outputs.ENV_NAME }}
steps:
- name: Determine the environment to deploy to
id: determine_environment
run: |
echo "ENV_NAME=$(
case ${{ github.ref }} in
"refs/heads/main")
echo "CMPDEV"
;;
"refs/heads/develop")
echo "Sandbox"
;;
"refs/heads/preview")
echo "Preview"
;;
"refs/heads/production")
echo "Production"
;;
*)
echo "FAIL"
;;
esac
)" >> $GITHUB_OUTPUT
- name: Fail if not an environment
run: |
echo "ERROR: No environment found"
exit 1
if: steps.determine_environment.outputs.ENV_NAME == 'FAIL'
- name: Show where we are deploying to
run: echo "We will deploy to ${{ steps.determine_environment.outputs.ENV_NAME }}"
deploy-to-aws:
uses: ./.github/workflows/deploy_to_aws.yml
needs:
- determine-environment
with:
environment: ${{ needs.determine-environment.outputs.ENV_NAME }}
secrets:
AWS_PIPELINE_REGION: ${{ secrets.AWS_PIPELINE_REGION }}
AWS_PIPELINE_ACCESS_KEY: ${{ secrets.AWS_PIPELINE_ACCESS_KEY }}
AWS_PIPELINE_SECRET_KEY: ${{ secrets.AWS_PIPELINE_SECRET_KEY }}
AWS_PIPELINE_MAIN_NAME: ${{ secrets.AWS_PIPELINE_MAIN_NAME }}
AWS_PIPELINE_SIDEKIQ_NAME: ${{ secrets.AWS_PIPELINE_SIDEKIQ_NAME }}