Skip to content

Update nextjs.yml

Update nextjs.yml #82

Workflow file for this run

name: Next.js CI
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install dependencies
run: cd nextjs-app && npm install
- name: linter
run: cd nextjs-app && npm run lint
- name: test
run: cd nextjs-app && npm test
- run: cd nextjs-app && npm install eslint prettier eslint-config-prettier eslint-plugin-prettier --save-dev
- name: Dockerhub Login
uses: docker/[email protected]
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Docker image
run: docker build -t ${{ vars.DOCKERHUB_USERNAME }}/nextjs-app ./nextjs-app
- name: Push Docker image
run: docker push ${{ vars.DOCKERHUB_USERNAME }}/nextjs-app