Skip to content

update Core and Dashboard README files #30

update Core and Dashboard README files

update Core and Dashboard README files #30

name: Build and Push Docker Images
on:
push:
branches:
- main
- master
paths:
- 'dashboard/**'
- 'src/**'
- '.github/workflows/build-and-push.yml'
tags:
- 'v*.*.*'
pull_request:
branches:
- main
- master
paths:
- 'dashboard/**'
- 'src/**'
- '.github/workflows/build-and-push.yml'
workflow_dispatch:
# Cancel in-progress runs on new commits to same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
CORE_IMAGE_NAME: ${{ github.repository_owner }}/simplens-core
DASHBOARD_IMAGE_NAME: ${{ github.repository_owner }}/simplens-dashboard
jobs:
# ============================================
# Test: simplens-core
# ============================================
test-core:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
# ============================================
# Build and Push: simplens-core
# ============================================
build-core:
runs-on: ubuntu-latest
needs: test-core
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for simplens-core
id: meta-core
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.CORE_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push simplens-core
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-core.outputs.tags }}
labels: ${{ steps.meta-core.outputs.labels }}
cache-from: type=gha,scope=core
cache-to: type=gha,mode=max,scope=core
platforms: linux/amd64
# ============================================
# Build and Push: simplens-dashboard
# ============================================
build-dashboard:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for simplens-dashboard
id: meta-dashboard
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.DASHBOARD_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push simplens-dashboard
uses: docker/build-push-action@v6
with:
context: ./dashboard
file: ./dashboard/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-dashboard.outputs.tags }}
labels: ${{ steps.meta-dashboard.outputs.labels }}
cache-from: type=gha,scope=dashboard
cache-to: type=gha,mode=max,scope=dashboard
platforms: linux/amd64