diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c56602a7e0..df43d9697fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,22 +40,13 @@ jobs: RELEASER_INSTALLATION_ID: ${{ secrets.RELEASER_INSTALLATION_ID }} DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 - # with: - # registry-url: 'https://npm.pkg.github.com' - # node-version-file: '.nvmrc' - # - name: Publish to GitHub Packages - # run: npm run release:phase5 - # env: - # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # DEBUG: ${{ inputs.debug && '*' || '' }} - name: Call ui-kit-cd run: node ./scripts/deploy/trigger-ui-kit-cd.mjs env: GH_TOKEN: ${{ secrets.UI_KIT_CD_DISPATCHER }} - promote-prod: + npm-prod: needs: release - environment: 'Production' + environment: 'NPM Production' runs-on: 'ubuntu-latest' permissions: contents: read @@ -67,20 +58,60 @@ jobs: with: ref: 'release/v2' - uses: ./.github/actions/setup - - uses: ./.github/actions/setup-sfdx - name: Promote NPM package to production run: npm run promote:npm:latest - - name: Promote SFDX package to production - run: | - echo "${{ secrets.SFDX_AUTH_PACKAGE_JWT_KEY }}" > server.key - npx --no-install nx run quantic:"promote:sfdx:ci" - rm server.key - env: - SFDX_AUTH_CLIENT_ID: ${{ secrets.SFDX_AUTH_CLIENT_ID }} - SFDX_AUTH_JWT_KEY: ${{ secrets.SFDX_AUTH_JWT_KEY }} - SFDX_AUTH_JWT_USERNAME: ${{ secrets.SFDX_AUTH_JWT_USERNAME }} - SFDX_AUTH_JWT_KEY_FILE: server.key - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: ./packages/quantic + docs-prod: + needs: release + runs-on: ubuntu-latest + environment: 'Docs Production' + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + ref: 'release/v2' + - uses: ./.github/actions/setup - name: Notify Docs run: npm run notify:docs + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # TODO: KIT-3072, uncomment + # quantic-prod: + # needs: release + # runs-on: ubuntu-latest + # environment: 'Quantic Production' + # permissions: + # contents: read + # packages: write + # steps: + # - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + # with: + # ref: 'release/v2' + # - uses: ./.github/actions/setup + # - uses: ./.github/actions/setup-sfdx + # - name: Promote SFDX package to production + # run: | + # echo "${{ secrets.SFDX_AUTH_PACKAGE_JWT_KEY }}" > server.key + # npx --no-install nx run quantic:"promote:sfdx:ci" + # rm server.key + # env: + # SFDX_AUTH_CLIENT_ID: ${{ secrets.SFDX_AUTH_CLIENT_ID }} + # SFDX_AUTH_JWT_KEY: ${{ secrets.SFDX_AUTH_JWT_KEY }} + # SFDX_AUTH_JWT_USERNAME: ${{ secrets.SFDX_AUTH_JWT_USERNAME }} + # SFDX_AUTH_JWT_KEY_FILE: server.key + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # working-directory: ./packages/quantic + + # TODO KIT-3074 Fix the publication into the GitHub Packages, and uncomment + # github-prod: + # needs: release + # runs-on: ubuntu-latest + # environment: 'GitHub Production' + # steps: + # - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 + # with: + # registry-url: 'https://npm.pkg.github.com' + # node-version-file: '.nvmrc' + # - name: Publish to GitHub Packages + # run: npm run release:phase5 + # env: + # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # DEBUG: ${{ inputs.debug && '*' || '' }} diff --git a/scripts/deploy/approve-production-release.mjs b/scripts/deploy/approve-production-release.mjs index 7c17dc30d3b..1d736e448d6 100644 --- a/scripts/deploy/approve-production-release.mjs +++ b/scripts/deploy/approve-production-release.mjs @@ -12,17 +12,32 @@ const authSecrets = { installationId: process.env.RELEASER_INSTALLATION_ID, }; +const productionEnvironments = [ + 'NPM Production', + 'Docs Production', + // TODO KIT-3072: uncomment + // 'Quantic Production', + + // TODO KIT-3074: uncomment + // 'GitHub Production', +]; + const octokit = new Octokit({ authStrategy: createAppAuth, auth: authSecrets, }); -await octokit.request( - `POST /repos/coveo/ui-kit/actions/runs/${process.argv[2]}/deployment_protection_rule`, - { - state: 'approved', - environment_name: 'Production', - headers: { - 'X-GitHub-Api-Version': '2022-11-28', - }, - } + +await Promise.allSettled( + productionEnvironments.map((environment_name) => + octokit.request( + `POST /repos/coveo/ui-kit/actions/runs/${process.argv[2]}/deployment_protection_rule`, + { + state: 'approved', + environment_name, + headers: { + 'X-GitHub-Api-Version': '2022-11-28', + }, + } + ) + ) );