diff --git a/.github/actions/build-proxies/action.yml b/.github/actions/build-proxies/action.yml index fe6f4064f..9b91369fe 100644 --- a/.github/actions/build-proxies/action.yml +++ b/.github/actions/build-proxies/action.yml @@ -8,6 +8,10 @@ inputs: releaseVersion: description: "Release, tag, branch, or commit ID to be used for deployment" required: true + isRelease: + description: "True if releaseVersion is a release tag (if set, downloads from release assets instead of workflow artifacts)" + required: false + default: false environment: description: "Deployment environment" required: true @@ -30,12 +34,29 @@ runs: using: composite steps: - - name: Download OAS Spec artifact + - name: Download OAS Spec artifact from workflow + if: ${{ inputs.isRelease == 'false' }} uses: actions/download-artifact@v4 with: name: api-oas-specification-${{ inputs.apimEnv }}${{ inputs.version != '' && format('-{0}', inputs.version) || '' }} path: ./build + - name: Download OAS Spec artifact from release + if: ${{ inputs.isRelease == 'true' }} + shell: bash + run: | + mkdir ./build + ASSET_PATTERN="api-oas-specification-${{ inputs.apimEnv }}-*.zip" + gh release download "${{ inputs.releaseVersion }}" \ + --pattern "$ASSET_PATTERN" \ + --dir ./build + # Unzip the downloaded file (there should be exactly one match) + ASSET_FILE=$(ls ./build/api-oas-specification-${{ inputs.apimEnv }}-*.zip) + unzip "$ASSET_FILE" -d ./build + rm "$ASSET_FILE" + env: + GH_TOKEN: ${{ github.token }} + - name: Setup Proxy Name and target shell: bash run: | diff --git a/.github/workflows/release_created.yaml b/.github/workflows/release_created.yaml index 7960e23cc..1bb3a60ab 100644 --- a/.github/workflows/release_created.yaml +++ b/.github/workflows/release_created.yaml @@ -17,11 +17,6 @@ jobs: id-token: write contents: read - strategy: - max-parallel: 1 - matrix: - component: [api] - steps: - name: Checkout repository uses: actions/checkout@v5 @@ -36,5 +31,32 @@ jobs: --targetWorkflow "dispatch-deploy-static-notify-supplier-api-env.yaml" \ --targetEnvironment "main" \ --targetAccountGroup "nhs-notify-supplier-api-nonprod" \ - --targetComponent "${{ matrix.component }}" \ + --targetComponent "api" \ --terraformAction "apply" + deploy-proxy: + name: "Deploy proxy" + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + id-token: write + contents: read + actions: read + + env: + PROXYGEN_API_NAME: nhs-notify-supplier + APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }} + APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }} + + steps: + - name: "Checkout code" + uses: actions/checkout@v5 + + - name: "Build proxies" + uses: ./.github/actions/build-proxies + with: + environment: "main" + apimEnv: "int" + runId: "${{ github.run_id }}" + releaseVersion: "${{ github.event.release.tag_name }}" + isRelease: true