Skip to content

Update node.js.yml #992

Update node.js.yml

Update node.js.yml #992

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: "npm"
- run: npm ci
- run: npm run build --if-present
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker Image
run: |
docker build -t ghcr.io/clouditor/medina-ui .
- name: Login Docker Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
if: github.ref == 'refs/heads/main'
- name: Push Docker Image
run: |
docker push ghcr.io/clouditor/medina-ui
if: github.ref == 'refs/heads/main'
- name: Push Docker Image (as Version)
run: |
export VERSION=`expr substr $GITHUB_REF 12 5`
docker tag ghcr.io/clouditor/medina-ui ghcr.io/clouditor/medina-ui:$VERSION
docker push ghcr.io/clouditor/medina-ui:$VERSION
if: startsWith(github.ref, 'refs/tags')