Merge pull request #149 from Crown-Commercial-Service/release-2.0.1 #22
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 GPaaS" | |
on: | |
push: | |
branches: | |
- develop | |
- preprod | |
- main | |
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/develop") | |
echo "development" | |
;; | |
"refs/heads/preprod") | |
echo "pre-production" | |
;; | |
"refs/heads/main") | |
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-gpaas: | |
uses: ./.github/workflows/deploy_to_gpaas.yml | |
needs: | |
- determine-environment | |
with: | |
environment: ${{ needs.determine-environment.outputs.ENV_NAME }} | |
secrets: | |
CF_API: ${{ secrets.CF_API }} | |
CF_USERNAME: ${{ secrets.CF_USERNAME }} | |
CF_PASSWORD: ${{ secrets.CF_PASSWORD }} | |
CF_ORG: ${{ secrets.CF_ORG }} |