Skip to content

Bump node from 16.14.2 to 22.2.0 #373

Bump node from 16.14.2 to 22.2.0

Bump node from 16.14.2 to 22.2.0 #373

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
packages: write
env:
CONTAINER_REGISTRY: ghcr.io
jobs:
test:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: cp .env.dist .env
- name: Build container
run: docker build . -t jazle --target base
- name: Cache NPM
uses: actions/cache@v2
with:
path: /tmp/cache/.npm
key: ${{ runner.os }}-build-npm-${{ hashFiles('package*.json') }}
restore-keys: |
${{ runner.os }}-build-npm-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
env:
NPM_CONFIG_CACHE: /tmp/npm-cache
run: |
mkdir -p /tmp/npm-cache
chmod 777 /tmp/npm-cache
docker run -v$(pwd):/app \
-v/tmp/cache/.npm:${NPM_CONFIG_CACHE} \
-e NPM_CONFIG_CACHE \
jazle \
npm install
- name: Test
run: docker run -v$(pwd):/app -e CI jazle npm run test
- name: Lint
run: docker run -v$(pwd):/app -e CI jazle npm run lint
- name: Create the production build
env:
REACT_APP_GOOGLE_MEASUREMENT_ID: ${{ secrets.GOOGLE_MEASUREMENT_ID }}
run: |
docker run -v$(pwd):/app \
-e REACT_APP_GOOGLE_MEASUREMENT_ID \
jazle \
npm run build
- name: Log in to the Container registry
if: ${{ github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tag
if: ${{ github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
id: tag-determiner
env:
PR_NUM: ${{ github.event.pull_request.number }}
run: |
SECONDS_IN_YEAR=$(($(date +%s) - $(date +%s --date="$(date +%Y)-01-01 00:00:00 UTC")))
# Seconds in hex padded to 7 digits
SECONDS_HEX=$(printf "%.7x\n" ${SECONDS_IN_YEAR})
# Replace slashes in refname since not supported in image tags
REF_NAME=$(echo ${GITHUB_REF_NAME} | sed -e 's~/~-~g')
if [ -n "${PR_NUM}" ]
then
REF_NAME=pr-${PR_NUM}
fi
echo "::set-output name=tag-name::${REF_NAME}-$(date +%Y)-${SECONDS_HEX}"
- name: Build and push production container image
if: ${{ github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: Dockerfile.prod
push: true
tags: ${{ env.CONTAINER_REGISTRY }}/${{ github.repository }}:${{ steps.tag-determiner.outputs.tag-name }}