Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,21 @@ updates:
patterns:
- "debug"
- "@types/debug"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "17:00"
assignees:
- "nerjs"
labels:
- "dependencies"
- "bot"
- "github-actions"
target-branch: "dependencies"
open-pull-requests-limit: 5
groups:
actions:
patterns:
- "*"
72 changes: 28 additions & 44 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,43 @@
# This is a basic workflow that is manually triggered

name: Bump version

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: 'Semver type of new version (major / minor / patch)'
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major
options:
- patch
- minor
- major

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "bump-version"
bump-version:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check out the content (source branch). Use a deploy key so that
# when we push changes, it will trigger the release workflow
# run that runs on: tag. (Using the GitHub token would
# not run the workflow to prevent infinite recursion.)
- name: Check out source
uses: actions/checkout@v3
with:
token: ${{ secrets.PUBLISH_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install npm packages
run: npm ci

- name: Setup Git
run: |
git config user.name 'nerjs'
git config user.email 'nerjs.stap@gmail.com'


- name: bump version
run: npm version ${{ github.event.inputs.version }}

- name: Push latest version
run: git push origin main --follow-tags
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PUBLISH_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Setup Git
run: |
git config user.name 'nerjs'
git config user.email 'nerjs.stap@gmail.com'

- name: Bump version
run: npm version ${{ github.event.inputs.version }}

- name: Push latest version
run: git push origin main --follow-tags
53 changes: 22 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,43 @@ name: "CI: tests, linter and build"
on:
workflow_dispatch:
push:
branches:
branches:
- main
- develop
- dependencies
- 'dependencies-**'
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- main
- dependencies


jobs:
try-build:
build:
if: "!contains(github.event.head_commit.message, '[skip-CI]')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 18
- 20
- 22
os:
- ubuntu-22.04
- ubuntu-latest
runs-on: ${{ matrix.os }}
name: os:${{ matrix.os }}; node:${{ matrix.node-version }}. Run linter, tests and Trying to build
node-version: [20, 22, 24]
name: "node:${{ matrix.node-version }}"
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Dependencies installation
cache: 'npm'

- name: Install dependencies
run: npm ci
- name: check versions
run: |
node -v
npm -v
- name: run linter
run: npm run lint
- name: run build

- name: Run linter
run: npm run lint

- name: Run build
run: npm run build
- name: run tests in development env
run: npm run test -- --bail=2 --ci --coverage=true --runInBand --coverageReporters=text
- name: run tests in production env
run: NODE_ENV=production npm run test -- --bail=2 --ci --coverage=false --runInBand

- name: check
run: git status
- name: Run tests
run: npm test -- --ci --coverage --runInBand --coverageReporters=text
70 changes: 39 additions & 31 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
name: Create Release

on:
push:
tags:
- 'v*'

name: Create Release


jobs:

lint-and-tests:
name: Run linter and tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint
- name: Run tests
run: npm run test -- --ci


- name: Run tests
run: npm test -- --ci

publish-to-npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: lint-and-tests
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
token: ${{ secrets.PUBLISH_TOKEN }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
token: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install dependencies
run: npm ci
- name: build
run: npm run build
- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PUBLISH_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
registry-url: https://registry.npmjs.org


- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

create-github-release:
name: Create GitHub Release
Expand All @@ -56,9 +63,10 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Create Release
run: gh release create ${{ github.ref }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
55 changes: 40 additions & 15 deletions .github/workflows/sync-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
name: "SYNC: dependencies with main"


on:
push:
branches:
branches:
- main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: write
pull-requests: write

jobs:
# This workflow contains a single job called "bump-version"
sync:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Check out source
- name: Check out dependencies
uses: actions/checkout@v4
with:
token: ${{ secrets.PUBLISH_TOKEN }}
ref: dependencies

- name: fetch
run: git fetch
fetch-depth: 0
token: ${{ secrets.PUBLISH_TOKEN }}

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Try merge main
id: merge
run: |
git fetch origin main
if git merge origin/main -m "Sync main to dependencies [skip-CI]"; then
echo "result=success" >> $GITHUB_OUTPUT
else
git merge --abort
echo "result=conflict" >> $GITHUB_OUTPUT
fi

- name: pull main
run: git merge origin/main --no-edit
- name: Push if no conflicts
if: steps.merge.outputs.result == 'success'
run: git push origin dependencies

- name: push into dependencies
run: git push origin dependencies
- name: Create PR if conflicts
if: steps.merge.outputs.result == 'conflict'
env:
GH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: |
existing=$(gh pr list --base dependencies --head main --json number --jq '.[0].number')
if [ -n "$existing" ]; then
echo "Sync PR #$existing already exists"
else
gh pr create --base dependencies --head main \
--title "Sync: merge main into dependencies (conflicts)" \
--body "Merge conflicts. Resolve manually."
fi
Loading
Loading