|
| 1 | +name: Build PR-Preview |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request_review: |
| 5 | + types: submitted |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{github.workflow}}-${{github.ref}} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +env: |
| 12 | + LAYOUT_EDITOR_BASE_URL: "/EmbeddedChat/pulls/pr-${{github.event.pull_request.number}}/layout_editor" |
| 13 | + DOCS_BASE_URL: "/EmbeddedChat/pulls/pr-${{github.event.pull_request.number}}/docs" |
| 14 | + STORYBOOK_RC_HOST: "https://demo.qa.rocket.chat" |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + if: github.event.review.state == 'approved' && (github.event.review.author_association == 'COLLABORATOR' || github.event.review.author_association == 'OWNER') |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Setup Node.js |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: "16.19.0" |
| 29 | + |
| 30 | + - name: Install Dependencies |
| 31 | + run: yarn install |
| 32 | + |
| 33 | + - name: Build packages |
| 34 | + run: yarn build && yarn build:storybook |
| 35 | + |
| 36 | + - name: Setup Node.js for Docs |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: "18.x" |
| 40 | + |
| 41 | + - name: "Install dependencies for docs" |
| 42 | + run: yarn install |
| 43 | + working-directory: packages/docs/ |
| 44 | + |
| 45 | + - name: Build Docs |
| 46 | + run: yarn build |
| 47 | + working-directory: packages/docs/ |
| 48 | + |
| 49 | + - name: Prepare Build Folder |
| 50 | + run: | |
| 51 | + mkdir -p build/pulls/pr-${{github.event.pull_request.number}}/ |
| 52 | + mkdir -p build/pulls/pr-${{github.event.pull_request.number}}/ui-elements |
| 53 | + mkdir -p build/pulls/pr-${{github.event.pull_request.number}}/layout_editor |
| 54 | + mkdir -p build/pulls/pr-${{github.event.pull_request.number}}/docs |
| 55 | +
|
| 56 | + mv -v packages/react/storybook-static/* build/pulls/pr-${{github.event.pull_request.number}}/ |
| 57 | + mv -v packages/ui-elements/storybook-static/* build/pulls/pr-${{github.event.pull_request.number}}/ui-elements/ |
| 58 | + mv -v packages/layout_editor/dist/* build/pulls/pr-${{github.event.pull_request.number}}/layout_editor/ |
| 59 | + mv -v packages/docs/build/* build/pulls/pr-${{github.event.pull_request.number}}/docs/ |
| 60 | +
|
| 61 | + - name: Upload Artifacts |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: github-pages |
| 65 | + path: build/ |
0 commit comments