update version #100
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Build Frontend | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
release: | |
types: [ "published" ] | |
workflow_dispatch: | |
env: | |
REGISTRY: "ghcr.io" | |
ORG: "IBM" | |
IMAGE_NAME: "cbomkit-frontend" | |
jobs: | |
build: | |
defaults: | |
run: | |
working-directory: "./frontend" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [21.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build --if-present | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=edge,branch=main | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha,format=long | |
- name: Log in to the Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
if: github.event_name != 'pull_request' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: github.event_name != 'pull_request' | |
uses: docker/setup-buildx-action@v3 | |
- name: Test Docker Build | |
if: github.event_name == 'pull_request' | |
uses: docker/build-push-action@v6 | |
with: | |
context: "./frontend" | |
file: "./frontend/docker/Dockerfile" | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Build and push to all platforms | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v6 | |
with: | |
context: "./frontend" | |
file: "./frontend/docker/Dockerfile" | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |