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
45 changes: 45 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'feat'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'maintenance'
- title: '📚 Documentation'
labels:
- 'docs'
- 'documentation'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'feature'
- 'feat'
patch:
labels:
- 'patch'
- 'fix'
- 'bug'
- 'chore'
- 'dependencies'
- 'docs'
default: patch
template: |
## Changes

$CHANGES
17 changes: 6 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: borales/actions-yarn@v5.0.0
with:
cmd: install
- uses: borales/actions-yarn@v5.0.0
with:
cmd: build
- uses: borales/actions-yarn@v5.0.0
with:
cmd: test
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- run: pnpm install
- run: pnpm build
- run: pnpm test
14 changes: 9 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: actions/setup-node@v4
with:
node-version: 24
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
package-manager: yarn
test-script: yarn jest
package-manager: pnpm
test-script: pnpm jest
output: report-markdown

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
branches:
- master

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
branches:
- master
tags:
- 'v*'
workflow_dispatch:

jobs:
# Job 1: Detect version bump in package.json and create a tag
detect-and-tag:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tagged: ${{ steps.tag.outputs.tagged }}
version: ${{ steps.pkg.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from package.json
id: pkg
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Check if tag already exists
id: check
run: |
VERSION=v${{ steps.pkg.outputs.version }}
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag $VERSION already exists. Skipping."
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "New version detected: $VERSION"
fi

- name: Create and push tag
id: tag
if: steps.check.outputs.exists == 'false'
run: |
VERSION=v${{ steps.pkg.outputs.version }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
echo "tagged=true" >> $GITHUB_OUTPUT
echo "Created and pushed tag: $VERSION"

# Job 2: Publish to npm when a tag is pushed (uses OIDC authentication)
publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install and Build
run: |
pnpm install --frozen-lockfile
pnpm build
pnpm test

- name: Publish to NPM (OIDC)
run: npm publish --provenance --access public

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
3 changes: 0 additions & 3 deletions .npmrc

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarnrc.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![CI](https://github.com/sha1n/dagraph/actions/workflows/ci.yml/badge.svg)](https://github.com/sha1n/dagraph/actions/workflows/ci.yml)
[![Coverage](https://github.com/sha1n/dagraph/actions/workflows/coverage.yml/badge.svg)](https://github.com/sha1n/dagraph/actions/workflows/coverage.yml)
[![codecov](https://codecov.io/gh/sha1n/dagraph/graph/badge.svg?token=TO3WOMYR2U)](https://codecov.io/gh/sha1n/dagraph)
![GitHub](https://img.shields.io/github/license/sha1n/dagraph)
![npm type definitions](https://img.shields.io/npm/types/@sha1n/dagraph)
![npm](https://img.shields.io/npm/v/@sha1n/dagraph)
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sha1n/dagraph",
"version": "0.1.0",
"version": "0.2.0",
"type": "commonjs",
"description": "Directed acyclic graph utility in TypeScript",
"repository": "https://github.com/sha1n/dagraph",
Expand All @@ -20,9 +20,9 @@
"scripts": {
"clean": "rm -rf ./dist",
"build": "tsc",
"test": "DEBUG='error:*' jest --coverage && run lint",
"test": "DEBUG='error:*' jest --coverage && pnpm lint",
"lint": "eslint --fix --ext .js,.ts .",
"prepare": "npm run build"
"prepare": "pnpm run build"
},
"devDependencies": {
"@types/jest": "^27.0.2",
Expand All @@ -48,7 +48,11 @@
"typescript": "^4.9.5",
"uuid": "^8.3.2"
},
"packageManager": "yarn@3.2.0",
"packageManager": "pnpm@10.28.0",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"engines": {
"node": ">= 24"
},
Expand Down
Loading
Loading