Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build-frontend-app-generic.yml #33

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/build-frontend-app-generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
on:
workflow_call:
inputs:
dockerImage:
description: 'Name of the Docker image (e.g., organization/app-name)'
required: true
type: string
dockerUsername:
required: true
type: string
eventOrganizations:
required: false
default: ''
type: string
eventType:
required: true
type: string
environment:
required: false
default: 'release'
type: string
licensercPath:
required: false
default: ''
type: string
secrets:
sonar-token:
required: true
DOCKERHUB_TOKEN:
required: true
repo-token:
required: true

env:
NODE_OPTIONS: '--max_old_space_size=4096'

jobs:
license-headers:
if: ${{ inputs.licensercPath != '' }}
name: Check licenses headers
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 v4.2.2
with:
persist-credentials: false

- name: Check License Header (Check Mode)
uses: apache/skywalking-eyes/header@6b2529214f6b1ccee3ec92bb0adfeabf6f66f538 # v0.5.0
with:
config: ${{ inputs.licensercPath }}

build:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref == 'refs/heads/main' && inputs.environment || '' }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 v4.2.2
with:
persist-credentials: false
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 v4.3.0
with:
node-version: 22

- name: Install Dependencies
run: npm ci

- name: Quality Checks
run: |
npm run test:coverage
npm run licenses-check

- name: Build Application
run: npm run build

- name: SonarCloud Analysis
uses: SonarSource/sonarcloud-github-action@eb211723266fe8e83102bac7361f0a05c3ac1d1b # v3.0.0
env:
SONAR_TOKEN: ${{ secrets.sonar-token }}

- name: Build and publish Docker image - Main
if: github.ref == 'refs/heads/main'
uses: elgohr/Publish-Docker-Github-Action@33a481be3e179353cb7793a92b57cf9a6c985860 # v4
with:
name: ${{ inputs.dockerImage }}
username: ${{ inputs.dockerUsername }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Broadcast update event
if: github.ref == 'refs/heads/main'
uses: gridsuite/broadcast-event@67201bc793618876822097ce2152b23b496a8227 # main
with:
token: ${{ secrets.repo-token }}
organizations: ${{ inputs.eventOrganizations }}
event-type: ${{ inputs.eventType }}