diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a31dc2..8e75678 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml new file mode 100644 index 0000000..6708d20 --- /dev/null +++ b/.github/workflows/patch.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2e71f07 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/README.md b/README.md index 3491c20..a623495 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..93d6576 --- /dev/null +++ b/sonar-project.properties @@ -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/** \ No newline at end of file