Skip to content

Shake-off

Shake-off #593

Workflow file for this run

name: Lint, test & deploy docker image
on: [push]
concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test:
name: Lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: 'package-lock.json'
- name: Set npm access token
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build app
run: npm run build --if-present
- name: Run tests
run: npm run test
- uses: hadolint/[email protected]
with:
dockerfile: ./Dockerfile
config: ./.hadolint.yaml
docker:
needs: [test]
name: Publish Docker images
runs-on: ubuntu-latest
# run job only for master and tags
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: 'package-lock.json'
- name: Set npm access token
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Build app
env:
REACT_APP_DEFAULT_ENV: brubeck
REACT_APP_BASENAME: /network-explorer
REACT_APP_PUBLIC_URL: /network-explorer
REACT_APP_MAPBOX_TOKEN: pk.eyJ1Ijoic3RyZWFtci1uZSIsImEiOiJja3Q0M29zOGkwNmt2MzFwN2d1OWthc2Z4In0.np5n6kX7ea0ig_5TUXdXbw
run: npm run build --if-present
- name: Build Docker image
run: docker build -t $OWNER/$IMAGE_NAME:local --build-arg NPM_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }} .
- name: Smoke test image
run: .ci_scripts/smoke_test.sh
- uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push streamr/network-explorer:dev
run: .ci_scripts/deploy_docker.sh dev
- name: Push streamr/network-explorer:version
run: .ci_scripts/deploy_docker.sh production ${GITHUB_REF#refs/tags/}
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
env:
OWNER: streamr
IMAGE_NAME: network-explorer