Skip to content
76 changes: 16 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,20 @@
name: CI

on: [push]
on:
push:
branches:
- 'main'
pull_request:

jobs:
license-headers:
name: Check licenses headers
runs-on: ubuntu-latest

steps:
- uses: actions/setup-node@v3
- name: Checkout sources
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Check License Header (Check Mode)
uses: apache/skywalking-eyes/header@v0.5.0
with:
config: .github/config/.licenserc.yaml

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 licenses-check
npm run-script test
npm run-script 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/gridXXX-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/gridstudy-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: gridXXX_app_updated
build:
uses: powsybl/github-ci/.github/workflows/build-frontend-app-generic.yml@3ed0caeb3395e55868884f466d726ddaee877850
with:
dockerImage: gridsuite/gridXXX-app
dockerUsername: gridsuiteci
eventType: gridXXX_app_updated
licensercPath: .github/config/.licenserc.yaml
secrets:
sonar-token: ${{ secrets.SONAR_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
repo-token: ${{ secrets.REPO_ACCESS_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Patch

on:
workflow_dispatch:
inputs:
releaseVersion:
description: Release version (vX.X)
required: true
type: string

jobs:
run-patch:
uses: powsybl/github-ci/.github/workflows/patch-frontend-app-generic.yml@3ed0caeb3395e55868884f466d726ddaee877850
with:
releaseVersion: ${{ github.event.inputs.releaseVersion }}
dockerImage: docker.io/gridsuite/gridXXX-app
dockerUsername: gridsuiteci
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
secrets:
VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
workflow_dispatch:
inputs:
releaseVersion:
description: Release version (vX.X)
required: true
type: string
gitReference:
description: SHA of the commit from where to release or branch name
required: true
type: string

jobs:
run-release:
uses: powsybl/github-ci/.github/workflows/release-frontend-app-generic.yml@3ed0caeb3395e55868884f466d726ddaee877850
with:
releaseVersion: ${{ github.event.inputs.releaseVersion }}
commitSha: ${{ github.event.inputs.gitReference }}
dockerImage: docker.io/gridsuite/gridXXX-app
dockerUsername: gridsuiteci
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
secrets:
VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This template setup the authentication mechanism and provides a configured empty

To customize this repository for an app, search and replace the string `XXX` with the name of the app. For example, GridXXX -> GridFoo, gridXXX-app -> gridfoo-app.

Replace the Sonar projectKey `gridsuite_gridapp-template` in `sonar-project.properties` with the name of your project. For example, gridsuite_gridapp-template -> gridsuite_gridfoo-app.

Create a new view in study-server and replace `yyy` with the new token in rest api `src/rest/study.ts`.

## Typescript config
Expand Down
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

sonar.projectKey=gridsuite_gridapp-template
sonar.organization=gridsuite
sonar.projectBaseDir=src
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.cpd.exclusions=**/translations/**
Loading