Skip to content

Workflow file for this run

name: Pipeline
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
if: "!contains(github.event.head_commit.message, 'Release modkit-loader@')"
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
token: ${{((github.event_name == 'push') && secrets.ACCESS_TOKEN) || ((github.event_name != 'push') && secrets.GITHUB_TOKEN)}}
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-modkit-loader-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install
run: npm run install:all
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Env
id: env
run: |
LATEST=`npm view . version`
CURRENT=`cat package.json | jq -r .version`
if [ "$LATEST" != "$CURRENT" ]
then
echo ::set-output name=VERSION::$CURRENT
echo ::set-output name=SHOULD_RELEASE::true
echo current version is $CURRENT
fi
- name: Fix Coverage Paths
if: github.event_name == 'push'
working-directory: ./coverage
run: |
sed -i 's/\/home\/runner\/work\/modkit-loader\/modkit-loader\//\/github\/workspace\//g' lcov.info
sed -i 's/\/home\/runner\/work\/modkit-loader\/modkit-loader\//\/github\/workspace\//g' clover.xml
- name: Sonar
if: github.event_name == 'push'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{steps.env.outputs.VERSION}}
- name: Documentation
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.ACCESS_TOKEN }}
publish_dir: ./docs/dist
- name: Release
if: github.event_name == 'push' && steps.env.outputs.SHOULD_RELEASE == 'true'
run: npx [email protected] --ci --verbose --disable-metrics --increment=${{steps.env.outputs.VERSION}}
env:
GIT_AUTHOR_NAME: Github Action
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Github Action
GIT_COMMITTER_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}