diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 21062b4a41..d9e7487d3d 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -16,7 +16,6 @@ permissions: actions: read contents: read security-events: write - deployments: write jobs: build: @@ -27,19 +26,4 @@ jobs: uses: cloudscape-design/actions/.github/workflows/build-lint-test.yml@main secrets: inherit with: - artifact-path: pages/lib/static-default - artifact-name: dev-pages-react${{ matrix.react }} - react-version: ${{ matrix.react }} - deploy: - needs: build - name: deploy${{ matrix.react != 16 && format(' (React {0})', matrix.react) || '' }} - # skip this job for external contributions as they aren't supported and cause the job's failure - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - strategy: - matrix: - react: [16, 18] - uses: cloudscape-design/actions/.github/workflows/deploy.yml@main - secrets: inherit - with: - artifact-name: dev-pages-react${{ matrix.react }} - deployment-path: pages/lib/static-default + react-version: ${{ matrix.react }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..5593984949 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,67 @@ +name: Deploy + +on: + pull_request: + branches: + - main + +permissions: + id-token: write + actions: read + contents: read + deployments: write + +jobs: + # Quick build: compiles source and bundles dev pages without running tests. + # Produces the artifact consumed by deploy, allowing it to start + # before the full build+test job finishes. + quick-build: + name: quick-build${{ matrix.react != 16 && format(' (React {0})', matrix.react) || '' }} + # skip this job for external contributions + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + strategy: + matrix: + react: [16, 18] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm i + + - name: Quick build + run: npm run quick-build + env: + NODE_ENV: production + REACT_VERSION: ${{ matrix.react }} + + - name: Bundle dev pages + run: node_modules/.bin/webpack --config pages/webpack.config.integ.cjs --output-path pages/lib/static-default + env: + NODE_ENV: production + REACT_VERSION: ${{ matrix.react }} + + - name: Upload dev pages artifact + uses: actions/upload-artifact@v4 + with: + name: dev-pages-react${{ matrix.react }} + path: pages/lib/static-default + + deploy: + needs: quick-build + name: deploy${{ matrix.react != 16 && format(' (React {0})', matrix.react) || '' }} + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + strategy: + matrix: + react: [16, 18] + uses: cloudscape-design/actions/.github/workflows/deploy.yml@main + secrets: inherit + with: + artifact-name: dev-pages-react${{ matrix.react }} + deployment-path: pages/lib/static-default