55 version :
66 description : " Version number"
77 required : true
8+ environment :
9+ description : " Deployment environment"
10+ required : true
11+ apimEnv :
12+ description : " APIM environment"
13+ required : true
14+ runId :
15+ description : " GitHub Actions run ID to fetch the OAS artifact from"
16+ required : true
17+ buildSandbox :
18+ description : " Whether to build the sandbox OAS spec"
19+ required : false
20+ default : false
821
922runs :
1023 using : composite
@@ -25,46 +38,87 @@ runs:
2538 shell : bash
2639 run : |
2740
41+ ENV="${{ inputs.environment }}"
42+ if [[ "$ENV" == "internal-dev" || "$ENV" == pr* ]]; then
43+ echo "TARGET_DOMAIN=suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
44+ elif [[ "$ENV" == "uat" ]]; then
45+ echo "TARGET_DOMAIN=suppliers.nonprod.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
46+ elif [[ "$ENV" == "prod" ]]; then
47+ echo "TARGET_DOMAIN=suppliers.prod.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
48+ else
49+ echo "TARGET_DOMAIN=suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
50+ fi
51+
2852 if [ -z $PR_NUMBER ]
2953 then
3054 echo "INSTANCE=$PROXYGEN_API_NAME" >> $GITHUB_ENV
31- echo "TARGET=https://main.suppliers.dev.nhsnotify.national.nhs.uk " >> $GITHUB_ENV
55+ echo "TARGET=https://main.$TARGET_DOMAIN " >> $GITHUB_ENV
3256 echo "SANDBOX_TAG=latest" >> $GITHUB_ENV
3357 echo "MTLS_NAME=notify-supplier-mtls" >> $GITHUB_ENV
3458 else
35- echo "TARGET=https://pr$PR_NUMBER.suppliers.dev.nhsnotify.national.nhs.uk " >> $GITHUB_ENV
59+ echo "TARGET=https://pr$PR_NUMBER.$TARGET_DOMAIN " >> $GITHUB_ENV
3660 echo "INSTANCE=$PROXYGEN_API_NAME-PR-$PR_NUMBER" >> $GITHUB_ENV
3761 echo "SANDBOX_TAG=pr$PR_NUMBER" >> $GITHUB_ENV
3862 echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
3963 fi
4064
41- - name : Install Proxygen client
42- shell : bash
43- run : |
44- # Install proxygen cli
45- pip install pipx
46- pipx install proxygen-cli
65+ # - name: Install Proxygen client
66+ # shell: bash
67+ # run: |
68+ # # Install proxygen cli
69+ # pip install pipx
70+ # pipx install proxygen-cli
4771
48- # Setup proxygen auth and settings
49- mkdir -p ${HOME}/.proxygen
50- echo -n $PROXYGEN_PRIVATE_KEY | base64 --decode > ${HOME}/.proxygen/key
51- envsubst < ./.github/proxygen-credentials-template.yaml > ${HOME}/.proxygen/credentials.yaml
52- envsubst < ./.github/proxygen-credentials-template.yaml | cat
53- envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
54- envsubst < ./.github/proxygen-settings.yaml | cat
72+ # # Setup proxygen auth and settings
73+ # mkdir -p ${HOME}/.proxygen
74+ # echo -n $PROXYGEN_PRIVATE_KEY | base64 --decode > ${HOME}/.proxygen/key
75+ # envsubst < ./.github/proxygen-credentials-template.yaml > ${HOME}/.proxygen/credentials.yaml
76+ # envsubst < ./.github/proxygen-credentials-template.yaml | cat
77+ # envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
78+ # envsubst < ./.github/proxygen-settings.yaml | cat
5579
56- - name : Build sandbox oas
80+ - name : Build ${{ inputs.apimEnv }} oas
5781 working-directory : .
5882 shell : bash
5983 run : |
60- make build-json-oas-spec APIM_ENV=sandbox
84+ if [ ${{ inputs.apimEnv }} == "internal-dev-sandbox" ] && [ ${{ inputs.buildSandbox }} == true ]
85+ then
86+ echo "Building sandbox OAS spec"
87+ make build-json-oas-spec APIM_ENV=sandbox
88+ else
89+ echo "Building env specific OAS spec"
90+ make build-json-oas-spec APIM_ENV=${{ inputs.apimEnv }}
91+ fi
6192
62- - name : Set docker tag
63- shell : bash
64- run : |
65- jq --arg newtag "$SANDBOX_TAG" '.["x-nhsd-apim"].target.containers[0].image.tag = $newtag' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
93+ - name : Upload OAS Spec
94+ uses : actions/upload-artifact@v4
95+ with :
96+ name : ${{ inputs.apimEnv }}-build-output
97+ path : ./build
6698
67- - name : Deploy to Internal Dev Sandbox
99+ - name : Trigger deploy proxy
100+ env :
101+ PR_TRIGGER_PAT : ${{ secrets.PR_TRIGGER_PAT }}
68102 shell : bash
69103 run : |
70- proxygen instance deploy internal-dev-sandbox $INSTANCE build/notify-supplier.json --no-confirm
104+ #Change this back to proxy-deploy.yaml after testing
105+ .github/scripts/dispatch_internal_repo_workflow.sh \
106+ --infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
107+ --internalRef "feature/CCM-11938_workflow" \
108+ --targetWorkflow "dispatch-deploy-notify-account-provisioning.yaml" \
109+ --targetEnvironment "${{ inputs.environment }}" \
110+ --runId "${{ inputs.runId }}" \
111+ --buildSandbox ${{ inputs.buildSandbox }} \
112+ --apimEnvironment "${{ inputs.apimEnv }}" \
113+ --boundedContext "notify-supplier" \
114+ --targetDomain "$TARGET_DOMAIN"
115+
116+ # - name: Set docker tag
117+ # shell: bash
118+ # run: |
119+ # jq --arg newtag "$SANDBOX_TAG" '.["x-nhsd-apim"].target.containers[0].image.tag = $newtag' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
120+
121+ # - name: Deploy to Internal Dev Sandbox
122+ # shell: bash
123+ # run: |
124+ # proxygen instance deploy internal-dev-${{ inputs.apimEnv }} $INSTANCE build/notify-supplier.json --no-confirm
0 commit comments