Skip to content

.github/workflows/frontend-build.yml #1

.github/workflows/frontend-build.yml

.github/workflows/frontend-build.yml #1

Workflow file for this run

name: Frontend Build

Check failure on line 1 in .github/workflows/frontend-build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/frontend-build.yml

Invalid workflow file

(Line: 34, Col: 16): Unrecognized named-value: 'steps'. Located at position 1 within expression: steps.build.outcome, (Line: 37, Col: 16): Unrecognized named-value: 'steps'. Located at position 1 within expression: steps.test.outcome, (Line: 40, Col: 16): Unrecognized named-value: 'steps'. Located at position 1 within expression: steps.check.outcome
on:
workflow_call:
inputs:
node-version:
description: 'Node.js version'
required: false
type: string
default: '20'
working-directory:
description: 'Working directory for the frontend build'
required: false
type: string
default: 'desktop'
build-command:
description: 'Build command to run'
required: false
type: string
default: 'yarn build'
test-command:
description: 'Test command to run'
required: false
type: string
default: 'yarn test'
check-command:
description: 'Type check command to run'
required: false
type: string
default: 'yarn check'
outputs:
build-success:
description: 'Whether the build was successful'
value: ${{ steps.build.outcome }}
test-success:
description: 'Whether the tests passed'
value: ${{ steps.test.outcome }}
check-success:
description: 'Whether the type check passed'
value: ${{ steps.check.outcome }}
jobs:
frontend-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
cache-dependency-path: ${{ inputs.working-directory }}/yarn.lock
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: yarn install --frozen-lockfile
- name: Type check
id: check
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.check-command }}
- name: Run tests
id: test
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.test-command }}
- name: Build frontend
id: build
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.build-command }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: frontend-build-${{ github.run_id }}
path: ${{ inputs.working-directory }}/dist/
retention-days: 7
frontend-build-matrix:
runs-on: ubuntu-latest
if: inputs.node-version == 'matrix'
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: ${{ inputs.working-directory }}/yarn.lock
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: yarn install --frozen-lockfile
- name: Type check
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.check-command }}
- name: Run tests
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.test-command }}
- name: Build frontend
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.build-command }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: frontend-build-node-${{ matrix.node-version }}-${{ github.run_id }}
path: ${{ inputs.working-directory }}/dist/
retention-days: 7