Skip to content

Commit

Permalink
Update deps, add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Best-Codes committed Dec 8, 2024
1 parent a1449ea commit 3bd2d94
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release to NPM

on:
release:
types: [created]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: bun install

- name: Run tests
run: bun test

- name: Build package
run: bun run build

- name: Get release tag
id: get_tag
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Publish to npm
run: |
if [[ "${{ steps.get_tag.outputs.RELEASE_TAG }}" == *"-beta"* ]]; then
npm publish --tag beta --provenance
elif [[ "${{ steps.get_tag.outputs.RELEASE_TAG }}" == *"-alpha"* ]]; then
npm publish --tag alpha --provenance
else
npm publish --provenance
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "best-highlight",
"version": "0.1.9",
"version": "0.2.0",
"description": "A lightweight syntax highlighter",
"type": "module",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -45,14 +45,14 @@
"prepublishOnly": "bun run prepublish && bun run build"
},
"devDependencies": {
"@eslint/js": "^9.15.0",
"@types/bun": "^1.1.13",
"@eslint/js": "^9.16.0",
"@types/bun": "^1.1.14",
"@types/jsdom": "^21.1.7",
"dts-minify": "^0.3.3",
"eslint": "^9.15.0",
"globals": "^15.12.0",
"eslint": "^9.16.0",
"globals": "^15.13.0",
"jsdom": "^25.0.1",
"rollup": "^4.27.4",
"rollup": "^4.28.1",
"rollup-plugin-dts": "^6.1.1",
"typescript": "^5.7.2"
},
Expand All @@ -72,4 +72,4 @@
],
"author": "The-Best-Codes",
"license": "MIT"
}
}

0 comments on commit 3bd2d94

Please sign in to comment.