include website #56
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: Node.js Package | |
on: | |
push: | |
branches: master | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Get npm cache directory | |
id: npm-cache | |
run: echo "::set-output name=dir::$(npm config get cache)" | |
- name: Cache .npm directory | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/cache@v2.0.0 | |
with: | |
path: node_modules/ | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node_modules | |
- name: Install app dependencies | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: npm ci --prefer-offline --no-audit --progress=false | |
- run: npm run build | |
- uses: chrnorm/deployment-action@releases/v1 | |
name: Create GitHub deployment | |
id: deployment | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
description: Production builded from ${{ github.sha }} because of ${{ github.event_name }} by ${{ github.actor }} | |
- name: Semantic Release | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
run: npm run release | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
state: "success" | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Update deployment status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
state: "failure" | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |