Monorepo Build #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Monorepo Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
build_target: | |
description: "Choose what to build" | |
required: true | |
default: "both" | |
type: choice | |
options: | |
- ui | |
- api | |
- both | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
ui_changed: ${{ steps.changes.outputs.ui }} | |
api_changed: ${{ steps.changes.outputs.api }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
ui: | |
- 'packages/ui/**' | |
api: | |
- 'packages/api/**' | |
build-ui: | |
needs: detect-changes | |
if: > | |
github.event_name == 'workflow_dispatch' && (github.event.inputs.build_target == 'ui' || github.event.inputs.build_target == 'both') || | |
(github.event_name != 'workflow_dispatch' && needs.detect-changes.outputs.ui_changed == 'true') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: List folders | |
run: | | |
ls -la | |
- name: Build UI | |
run: | | |
cd packages/ui | |
bun install | |
bun run build | |
build-api: | |
needs: detect-changes | |
if: > | |
github.event_name == 'workflow_dispatch' && (github.event.inputs.build_target == 'api' || github.event.inputs.build_target == 'both') || | |
(github.event_name != 'workflow_dispatch' && needs.detect-changes.outputs.api_changed == 'true') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: List folders | |
run: | | |
ls -la | |
- name: Build API | |
run: | | |
cd packages/api | |
bun install | |
bun run build |