|
1 | 1 | name: Build |
2 | 2 | on: |
3 | | - push: |
4 | | - branches: |
5 | | - - master |
6 | | - pull_request: |
7 | | - branches: |
8 | | - - master |
9 | 3 | workflow_dispatch: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +permissions: |
| 7 | + actions: write |
| 8 | + contents: read |
10 | 9 |
|
11 | 10 | jobs: |
12 | | - build-openapi: |
| 11 | + pre: |
13 | 12 | runs-on: ubuntu-latest |
14 | | - name: Build OpenAPI |
| 13 | + name: Check Artifacts |
| 14 | + outputs: |
| 15 | + openapi: ${{ steps.openapi.outputs.exists }} |
| 16 | + openapi_dereferenced: ${{ steps.openapi_dereferenced.outputs.exists }} |
| 17 | + webpack: ${{ steps.webpack.outputs.exists }} |
15 | 18 | steps: |
16 | | - - uses: actions/checkout@v3 |
17 | | - - uses: pnpm/action-setup@v2 |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: ./.github/actions/artifact-exists |
| 21 | + id: openapi |
| 22 | + with: |
| 23 | + artifact_name: openapi.yaml |
| 24 | + - uses: ./.github/actions/artifact-exists |
| 25 | + id: openapi_dereferenced |
18 | 26 | with: |
19 | | - version: latest |
20 | | - - name: Install Dependencies |
21 | | - run: pnpm i --frozen-lockfile --ignore-scripts |
| 27 | + artifact_name: openapi.dereferenced.yaml |
| 28 | + - uses: ./.github/actions/artifact-exists |
| 29 | + id: webpack |
| 30 | + with: |
| 31 | + artifact_name: webpack |
| 32 | + |
| 33 | + openapi: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + name: Build OpenAPI |
| 36 | + needs: pre |
| 37 | + if: needs.pre.outputs.openapi != 'true' || needs.pre.outputs.openapi_dereferenced != 'true' |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: ./.github/actions/pnpm |
22 | 41 | - name: Build |
23 | 42 | run: pnpm run build:openapi |
24 | | - build-webpack: |
| 43 | + - name: Upload OpenAPI |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + path: openapi.yaml |
| 47 | + overwrite: true |
| 48 | + if-no-files-found: error |
| 49 | + compression-level: 0 |
| 50 | + name: openapi.yaml |
| 51 | + # dereferencing catches circular reference issues |
| 52 | + - name: Build (Dereferenced) |
| 53 | + run: pnpm run build:openapi:dereferenced |
| 54 | + - name: Upload OpenAPI |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + path: openapi.dereferenced.yaml |
| 58 | + overwrite: true |
| 59 | + if-no-files-found: error |
| 60 | + compression-level: 0 |
| 61 | + name: openapi.dereferenced.yaml |
| 62 | + webpack: |
25 | 63 | runs-on: ubuntu-latest |
26 | 64 | name: Build Webpack |
| 65 | + needs: pre |
| 66 | + if: needs.pre.outputs.webpack != 'true' |
27 | 67 | steps: |
28 | | - - uses: actions/checkout@v3 |
29 | | - - uses: pnpm/action-setup@v2 |
30 | | - with: |
31 | | - version: latest |
32 | | - - name: Install Dependencies |
33 | | - run: pnpm i --frozen-lockfile --ignore-scripts |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + - uses: ./.github/actions/pnpm |
34 | 70 | - name: Build |
35 | | - run: pnpm run build:webpack |
| 71 | + run: NODE_ENV=production pnpm run build:webpack |
| 72 | + - name: Upload Webpack |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + path: dist |
| 76 | + overwrite: true |
| 77 | + if-no-files-found: error |
| 78 | + name: webpack |
0 commit comments