Skip to content

feat: newman results as pull request comment #32

feat: newman results as pull request comment

feat: newman results as pull request comment #32

name: Build, test and publish
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install and run tests & coverage
run: |
npm ci
npm run lint
npm run coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish:
name: NPM publish
timeout-minutes: 10
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [build]
steps:
# Retrieves repo content
- uses: actions/checkout@v2
# Uses node v12
- name: Use Node.js v12
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
# Update release number
- name: Update release number
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
npm run release
git push
# Publishes npm package
- name: NPM publish
run: |
npm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}