CCM-11938: try remote #1
Workflow file for this run
This file contains hidden or 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: Deploy proxy to environment | |
| on: | |
| push: | |
| branches: | |
| - feature/CCM-11938_workflow | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version number | |
| required: true | |
| type: string | |
| environment: | |
| description: Name of the environment to deploy | |
| required: true | |
| type: choice | |
| default: internal-dev | |
| options: | |
| - internal-dev | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy-environment: | |
| runs-on: ubuntu-latest | |
| name: Deploy to Environment | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Npm install | |
| working-directory: . | |
| run: npm ci | |
| shell: bash | |
| - name: "Check if pull request exists for this branch" | |
| id: pr_exists | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')} | |
| echo "Current branch is '$branch_name'" | |
| pr_json=$(gh pr list --head "$branch_name" --state open --json number --limit 1) | |
| pr_number=$(echo "$pr_json" | jq -r '.[0].number // empty') | |
| if [[ -n "$pr_number" ]]; then | |
| echo "Pull request exists: #$pr_number" | |
| echo "does_pull_request_exist=true" >> $GITHUB_OUTPUT | |
| echo "pr_number=$pr_number" >> $GITHUB_OUTPUT | |
| else | |
| echo "Pull request doesn't exist" | |
| echo "does_pull_request_exist=false" >> $GITHUB_OUTPUT | |
| echo "pr_number=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set APIM_ENV | |
| shell: bash | |
| env: | |
| ENVIRONMENT: ${{ inputs.environment }} | |
| PR_NUMBER: ${{ steps.pr_exists.outputs.pr_number }} | |
| run: | | |
| if [ -z "$PR_NUMBER" ]; then | |
| echo "APIM_ENV=$ENVIRONMENT" >> $GITHUB_ENV | |
| else | |
| echo "APIM_ENV=${ENVIRONMENT}-pr" >> $GITHUB_ENV | |
| fi | |
| - name: Build environment oas | |
| working-directory: . | |
| shell: bash | |
| env: | |
| APIM_ENV: ${{ env.APIM_ENV }} | |
| run: make build-json-oas-spec APIM_ENV=$APIM_ENV | |
| - name: "Build proxies" | |
| uses: ./.github/actions/build-proxies | |
| with: | |
| version: "${{ inputs.version }}" | |
| environment: "${{ inputs.environment }}" | |
| apimEnv: "${{ env.APIM_ENV }}" | |
| runId: "${{ github.run_id }}" | |
| buildSandbox: false | |
| releaseVersion: ${{ github.ref_name }} | |
| # - name: Set target and cert | |
| # shell: bash | |
| # run: | | |
| # jq --arg newurl "$TARGET" '.["x-nhsd-apim"].target.url = $newurl' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json | |
| # jq --arg newmtls "$MTLS_NAME" '.["x-nhsd-apim"].target.security.secret = $newmtls' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json | |
| # - name: Deploy to Internal Dev | |
| # shell: bash | |
| # run: | | |
| # proxygen instance deploy internal-dev $INSTANCE build/notify-supplier.json --no-confirm |