Skip to content

feat: configuring logger level and release via environment variables,… #141

feat: configuring logger level and release via environment variables,…

feat: configuring logger level and release via environment variables,… #141

Workflow file for this run

name: ci
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
version:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Version
uses: sergeysova/jq-action@v2
id: version
with:
cmd: 'jq --raw-output .version package.json'
- name: Check
run: |
_version_package="v${{ steps.version.outputs.value }}"
_version_git="${{ github.ref_name }}"
if [ ! "$_version_package" = "$_version_git" ]; then
printf "[ERROR]: Versions do not match --> 'package.json %s' != 'git tag %s'\n" "$_version_package" "$_version_git"
exit 1
fi
ci:
needs: version
if: always() && (needs.version.result == 'success' || needs.version.result == 'skipped')
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
node-version: [18.x, 20.x, 22.x]
fail-fast: true
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Check
run: npm run check
- name: Build
run: npm run build
- name: Test
run: npm run test:ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
needs: ci
if: startsWith(github.ref, 'refs/tags/') && needs.ci.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
configuration: './.github/configs/changelog.json'
owner: gunar
repo: shellcheck
failOnError: true
- name: Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}