Update build-frontend.yml #31
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: Build Frontend | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Clear npm cache | |
run: npm cache clean --force | |
- name: Install npm@latest | |
run: npm install -g npm@latest | |
- name: Verify Node.js version | |
run: node -v | |
- name: Verify npm version | |
run: npm -v | |
- name: List files in frontend directory | |
run: ls -la ./frontend | |
- name: Install dependencies | |
run: npm ci || npm install | |
working-directory: ./frontend | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
working-directory: ./frontend | |
- name: Run Playwright tests | |
run: npx playwright test | |
working-directory: ./frontend | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
tags: cesaredecal/wookieepedia-full-stack:frontend-latest |