Merge pull request #27 from AxaFrance/EmmanuelDemey-patch-1 #24
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 run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: lighthouse-ecoindex-aggregator | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
skip_ci: | |
runs-on: ubuntu-latest | |
outputs: | |
canSkip: ${{ steps.check.outputs.canSkip }} | |
steps: | |
- id: check | |
uses: Legorooj/skip-ci@main | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ needs.skip_ci.outputs.canSkip != 'true' }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GIT_TOKEN }} | |
- name: Bump version and push tag | |
id: tag_version | |
if: github.ref == 'refs/heads/master' | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: set user name | |
run: | | |
git config --global user.email "ci@axa.fr" | |
git config --global user.name "ci@axa.fr" | |
- name: npm version ${{ steps.tag_version.outputs.new_tag }} | |
if: github.ref == 'refs/heads/master' | |
run: npm version ${{ steps.tag_version.outputs.new_tag }} | |
- name: npm ci | |
run: npm ci | |
- name: npm test | |
run: npm test -- --runInBand --coverage --watchAll=false | |
- id: publish-aggregator | |
uses: JS-DevTools/npm-publish@v1 | |
if: github.ref == 'refs/heads/master' | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: ./package.json | |
# - name: SonarCloud Scan | |
# uses: sonarsource/sonarcloud-github-action@master | |
# if: github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.head.repo.fork | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# with: | |
# args: > | |
# -Dsonar.organization=axaguildev | |
# -Dsonar.projectKey=AxaGuilDEv_lighthouse-ecoindex-aggregator | |
# -Dsonar.exclusions=**/*.spec.js,**/*.stories.js,Scripts/**,**/*.scss,**/__snapshots__/**,**/*[Tt]ests.cs,**/node_modules/**,**/ClientApp/build/**,**/ClientApp/.storybook/**,**/ClientApp/storybook-static/**,**/obj/**,**/__mocks__/**,**/ClientApp/src/serviceWorker.ts | |
# -Dsonar.javascript.lcov.reportPaths=**/coverage/lcov.info | |
- name: Commit updates package.json | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
commit_message: "[skip ci] Update version package.json" | |
commit_user_name: GitHub | |
commit_user_email: github-action@bot.com | |
commit_author: GitHub <github-action@bot.com> | |
push_options: "--force" | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
if: github.ref == 'refs/heads/master' | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} |