Skip to content
Merged
Show file tree
Hide file tree
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
101 changes: 57 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,61 @@
name: CI

on: [push]
on:
push:
branches:
- 'main'
tags:
- 'v[0-9]*'
pull_request:

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false

- name: Parse tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF_NAME#v}

- name: Install and Build
run: |
npm install
npm run lint
npm run test
npm run build

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

- name: Build and publish Docker image - Tag
if: startsWith(github.ref, 'refs/tags/')
uses: elgohr/Publish-Docker-Github-Action@33a481be3e179353cb7793a92b57cf9a6c985860 # v4
with:
name: gridsuite/gridadmin-app
username: gridsuiteci
password: ${{ secrets.DOCKERHUB_TOKEN }}
tags: ${{ steps.vars.outputs.tag }}

- name: Broadcast update event
if: github.ref == 'refs/heads/main'
uses: gridsuite/broadcast-event@main
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: gridadmin_app_updated
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
fetch-depth: 0
persist-credentials: false

- name: Parse tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF_NAME#v}

- name: Install and Build
run: |
npm install
npm run lint
npm run test:coverage
npm run build

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: gridsuite/gridadmin-app
username: gridsuiteci
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and publish Docker image - Tag
if: startsWith(github.ref, 'refs/tags/')
uses: elgohr/Publish-Docker-Github-Action@33a481be3e179353cb7793a92b57cf9a6c985860 # v4
with:
name: gridsuite/gridadmin-app
username: gridsuiteci
password: ${{ secrets.DOCKERHUB_TOKEN }}
tags: ${{ steps.vars.outputs.tag }}

- name: Broadcast update event
if: github.ref == 'refs/heads/main'
uses: gridsuite/broadcast-event@main
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: gridadmin_app_updated
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"build": "tsc && vite build",
"serve": "vite preview",
"test": "jest",
"test:coverage": "jest --coverage",
"lint": "eslint . --ext js,mjs,jsx,ts,mts,tsx --max-warnings 0"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sonar.projectKey=gridsuite_gridadmin-app
sonar.organization=gridsuite
sonar.projectBaseDir=src
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
Loading