diff --git a/.github/actions/prepare-nodemodules/action.yml b/.github/actions/prepare-nodemodules/action.yml new file mode 100644 index 0000000..a8804d4 --- /dev/null +++ b/.github/actions/prepare-nodemodules/action.yml @@ -0,0 +1,31 @@ +name: Prepare node_modules + +description: Install Dependencies using Bun. If cache hit, do nothing. + +inputs: + root: + description: |- + An absolute path to the directory where contains package.json. + Required + required: true + +runs: + using: composite + steps: + - uses: actions/cache@v4 + id: cache + with: + path: | + ${{ inputs.root }}/node_modules + ${{ inputs.root }}/.next/cache + key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lockb') }} + restore-keys: ${{ runner.os }}-bun-cache- + - uses: oven-sh/setup-bun@v1 + if: steps.cache.outputs.cache-hit != 'true' + with: + bun-version: latest + - name: Install dependencies + shell: bash + if: steps.cache.outputs.cache-hit != 'true' + working-directory: ${{ inputs.root }} + run: bun install diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml new file mode 100644 index 0000000..a461aa7 --- /dev/null +++ b/.github/workflows/build-app.yml @@ -0,0 +1,33 @@ +name: build-app + +on: + pull_request: + branches: + - develop + - main + paths: + - .github/workflows/build-app.yml + - "typing-app/**" + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + working-directory: typing-app + +jobs: + build: + name: Build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/prepare-nodemodules + with: + root: ${{ github.workspace }}/typing-app + - name: Build Next.js Project + run: npm run build