From 7bb886d3b96c691643487b121f347db095955576 Mon Sep 17 00:00:00 2001 From: Corentin Mors Date: Sat, 28 Jan 2023 15:27:17 +0100 Subject: [PATCH] Add worflow for public release --- .github/workflows/pr-validation.yml | 25 +++++++++++++++++++++ .github/workflows/publish.yml | 21 +++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++ README.md | 6 +++++ package-lock.json | 4 ++-- package.json | 23 ++++++++++++++----- 6 files changed, 107 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr-validation.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..d0929cc --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,25 @@ +name: Lint & Build CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run lint + - run: npm run build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..066e708 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish Package to npmjs + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci && npm run build + - name: Publish package on NPM 📦 + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ce1ae3a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Create Automatic Release + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + build: + name: Prepare release + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build project + run: | + npm ci + npm run build:prod + npm run zip + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/README.md b/README.md index bb60927..51335f8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # UPNP Client and MediaRenderer for NodeJS +![GitHub package.json version](https://img.shields.io/github/package-json/v/mikescops/upnp-client-ts) +![npm](https://img.shields.io/npm/v/upnp-client-ts) +![npm](https://img.shields.io/npm/dw/upnp-client-ts) +![GitHub](https://img.shields.io/github/license/mikescops/upnp-client-ts) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mikescops/upnp-client-ts/pr-validation.yml) + A modern UPNP client made in Typescript. Compatible with both ESM and CommonJS. - UpnpDeviceClient: to connect to any UPNP devices diff --git a/package-lock.json b/package-lock.json index f28ec31..b1ab120 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "upnp-client", + "name": "upnp-client-ts", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "upnp-client", + "name": "upnp-client-ts", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 2b0a551..c8abf20 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "upnp-client", + "name": "upnp-client-ts", "version": "1.0.0", "description": "A modern UPNP client made in Typescript.", "source": "src/index.ts", @@ -9,7 +9,7 @@ "scripts": { "watch": "parcel watch", "build": "parcel build", - "check": "tsc --noEmit" + "lint": "tsc --noEmit && eslint \"src/**/*.ts{,x}\"" }, "targets": { "module": { @@ -21,9 +21,15 @@ "context": "node" } }, - "keywords": [], - "author": "", - "license": "ISC", + "keywords": [ + "upnp", + "client", + "mediarenderer", + "typescript", + "module" + ], + "author": "Corentin Mors ", + "license": "MIT", "devDependencies": { "@parcel/packager-ts": "^2.8.3", "@parcel/transformer-typescript-tsc": "^2.8.3", @@ -44,5 +50,12 @@ }, "@parcel/transformer-js": { "inlineFS": false + }, + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/Mikescops/upnp-client-ts.git" } }