Merge pull request #4085 from Crown-Commercial-Service/dependabot/bun… #698
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Set up deployment of latest code to AWS" | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
- 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/master") | |
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 }} |