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
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ jobs:
lint-and-test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node: [20, 22]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: 22
cache: npm

- name: Install
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,36 @@ jobs:
with:
node-version: 22
cache: npm
registry-url: https://npm.pkg.github.com
scope: '@hanlogy'

- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build

- name: Read local version
id: local
run:
echo "version=$(node -p \"require('./package.json').version\")" >>
"$GITHUB_OUTPUT"

- name: Check published version
id: check
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PKG="@hanlogy/ts-lib"
REG="https://npm.pkg.github.com"
PUBLISHED="$(npm view "$PKG" version --registry="$REG" 2>/dev/null || echo "")"
if [ "$PUBLISHED" = "${{ steps.local.outputs.version }}" ]; then
echo "should_publish=false" >> "$GITHUB_OUTPUT"
else
echo "should_publish=true" >> "$GITHUB_OUTPUT"
fi

- name: Publish
if: steps.check.outputs.should_publish == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"type": "module",
"author": "hanlogy.com",
"license": "AGPL-3.0 license",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -26,7 +23,6 @@
"build:cjs": "tsc --project tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json",
"build:esm": "tsc --project tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
"build": "rm -rf dist && npm run build:cjs && npm run build:esm",
"prepublishOnly": "npm run build",
"prepack": "npm run build",
"test": "TZ=UTC jest"
},
Expand Down