diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0a0596a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + id-token: write # npm provenance + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Check tag matches package.json version + run: | + PKG_VERSION="v$(node -p 'require("./package.json").version')" + if [ "$PKG_VERSION" != "$GITHUB_REF_NAME" ]; then + echo "Tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION" + exit 1 + fi + + - name: Install dependencies + run: npm ci + + # prepublishOnly runs lint, typecheck and build + - name: Publish + run: npm publish --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index bb2c7ad..4b844d0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ JavaScript/TypeScript client library for the Application Distribution System API ## Installation -### From npm (when published) +### From npm ```bash npm install @bindist/client @@ -18,7 +18,8 @@ npm install @bindist/client ### From source ```bash -cd api/javascript +git clone https://github.com/BinDist/bindist-api-javascript.git +cd bindist-api-javascript npm install npm run build ``` diff --git a/package.json b/package.json index 180984c..e6b732d 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,20 @@ { "name": "@bindist/client", "version": "1.0.0", - "description": "Client library for the Application Distribution System API", + "description": "TypeScript/JavaScript client for the BinDist API", "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.mjs", - "require": "./dist/index.js" + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } } }, "files": [ @@ -21,7 +26,8 @@ "build:browser": "tsup src/browser.ts --format iife --minify --outDir dist/browser", "dev": "tsup src/index.ts --format cjs,esm --dts --watch", "lint": "eslint src/", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "prepublishOnly": "npm run lint && npm run typecheck && npm run build" }, "keywords": [ "bindist", @@ -29,7 +35,15 @@ "distribution", "application" ], - "author": "", + "author": "BinDist ", + "homepage": "https://docs.bindist.eu/sdks/javascript/", + "repository": { + "type": "git", + "url": "git+https://github.com/BinDist/bindist-api-javascript.git" + }, + "bugs": { + "url": "https://github.com/BinDist/bindist-api-javascript/issues" + }, "license": "MIT", "devDependencies": { "@eslint/js": "^9.0.0", @@ -41,5 +55,8 @@ }, "engines": { "node": ">=18.0.0" + }, + "publishConfig": { + "access": "public" } }