qlaffont/env-vars-validator

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: publish
on:
  pull_request:
    branches:
      - master
    types: [closed]

jobs:
  build:
    name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

    if: startsWith(github.head_ref, 'renovate/')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: ["18.x"]
        os: [ubuntu-latest]

    steps:
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            src:
              - 'src/**'
              - 'package.json'
              - 'pnpm-lock.yaml'

      - name: Checkout repo
        if: steps.changes.outputs.src == 'true'
        uses: actions/checkout@v3

      - if: steps.changes.outputs.src == 'true'
        run: |
          git config user.name "${{ secrets.USER_NAME }}"
          git config user.email "${{ secrets.USER_EMAIL }}"

      - if: steps.changes.outputs.src == 'true'
        name: Use Node ${{ matrix.node }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}

      - if: steps.changes.outputs.src == 'true'
        name: Install PNPM
        uses: pnpm/action-setup@v2.2.4
        with:
          version: 6.0.2

      - if: steps.changes.outputs.src == 'true'
        name: Install deps and build (with cache)
        run: pnpm install --no-frozen-lockfile

      - if: steps.changes.outputs.src == 'true'
        name: Lint
        run: pnpm lint

      - if: steps.changes.outputs.src == 'true'
        name: Test
        run: pnpm test -- --ci --coverage --maxWorkers=2

      - if: steps.changes.outputs.src == 'true'
        name: Build
        run: pnpm build

      - if: steps.changes.outputs.src == 'true'
        name: Bump version
        uses: qzb/standard-version-action@v1.0.13



      - if: steps.changes.outputs.src == 'true'
        run: |
          git config --global user.name "${{ secrets.USER_NAME }}"
          git config --global user.email "${{ secrets.USER_EMAIL }}"
          git push --follow-tags origin master

      - if: steps.changes.outputs.src == 'true'
        uses: JS-DevTools/npm-publish@v2
        with:
          token: ${{ secrets.NPM_TOKEN }}