Skip to content

update node version and package.json #2

update node version and package.json

update node version and package.json #2

Workflow file for this run

name: App Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main and develop branch
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Check linter, unit and e2e tests.
check:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout files
uses: actions/checkout@v2
- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: latest
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: '16.13'
cache: 'pnpm'
- name: Pnpm Cache
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
D:\.pnpm-store
**/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}
- name: Audit
run: pnpm audit --audit-level=high --prod
- name: Install dependencies from lock.
run: pnpm i --frozen-lockfile
- name: Linter.
run: pnpm lint:ci
- name: Unit tests.
run: pnpm test:cov
- name: E2E tests.
run: pnpm test:e2e
- name: Build source code.
run: pnpm build
# Build docker image
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Build needs check run before
needs: check
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
- name: Checkout files
uses: actions/checkout@v2
- name: Get docker tag
id: dockertag
uses: Surgo/docker-smart-tag-action@v1
with:
docker_image: blockcoders/nestjs-api-boilerplate
default_branch: ${{ env.GITHUB_REF_SLUG }}
tag_with_sha: true
- name: Docker tags
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: blockcoders/nestjs-api-boilerplate
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
no-cache: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker image digest
run: echo ${{ steps.docker_build.outputs.digest }}