diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml new file mode 100644 index 00000000..5f57f972 --- /dev/null +++ b/.github/workflows/frontend-ci.yml @@ -0,0 +1,48 @@ +name: Frontend CI + +on: + push: + branches: [ main ] + paths: + - 'frontend/**' + pull_request: + branches: [ main ] + paths: + - 'frontend/**' + workflow_dispatch: + +jobs: + build: + name: Install and Build Frontend + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./frontend + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + + - name: Install dependencies + run: npm ci + + - name: Build frontend + run: npm run build + + - name: Cache build artifacts + uses: actions/cache@v3 + with: + path: | + ./frontend/.next + ./frontend/node_modules + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- \ No newline at end of file