Skip to content

Commit 0e0b509

Browse files
authored
Merge pull request #112 from cloudnode-pro/publish-workflow
NPM publish workflow
2 parents 8b1e96c + c6cf11f commit 0e0b509

File tree

11 files changed

+44
-103
lines changed

11 files changed

+44
-103
lines changed

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-npm:
9+
name: Publish to npm
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
registry-url: https://registry.npmjs.org/
20+
cache: npm
21+
- run: npm install -g npm@latest
22+
- run: npm ci
23+
- run: npm version ${TAG_NAME} --git-tag-version=false
24+
env:
25+
TAG_NAME: ${{ github.event.release.tag_name }}
26+
- run: npm run generate; npm run readme
27+
- run: npm --provenance --access public
28+
env:
29+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Cloudnode API Client
22

3-
![Client Version: 3.0.0](https://img.shields.io/badge/Client%20Version-3.0.0-%2316a34a)
3+
[![npm](https://img.shields.io/npm/v/cloudnode-ts)](https://www.npmjs.com/package/cloudnode-ts)
44
![API Version: 5.13.0](https://img.shields.io/badge/API%20Version-5.13.0-%232563eb)
55
![build: passing](https://img.shields.io/badge/build-passing-%2316a34a)
6-
![npm downloads](https://img.shields.io/npm/dt/cloudnode-ts?label=downloads)
6+
[![CodeQL](https://github.com/cloudnode-pro/ts-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/cloudnode-pro/ts-client/actions/workflows/github-code-scanning/codeql)
7+
[![npm downloads](https://img.shields.io/npm/dt/cloudnode-ts?label=downloads)](https://www.npmjs.com/package/cloudnode-ts)
78

89
A client library for the Cloudnode API, written in TypeScript. [Documentation](https://github.com/cloudnode-pro/ts-client#documentation)
910

README.template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{{{shield.version}}}
44
{{{shield.apiVersion}}}
55
{{{shield.build}}}
6+
{{{shield.codeQl}}}
67
{{{shield.downloads}}}
78

89
{{pkg.description}}

browser/Cloudnode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Cloudnode {
3535
/**
3636
* Client user agent
3737
*/
38-
#userAgent = `cloudnode/2.1.0`;
38+
#userAgent = `cloudnode/0.0.0-dev`;
3939
/**
4040
* Construct a new Cloudnode API client
4141
* @param token API token to use for requests

browser/Cloudnode.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/docs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,11 @@ export async function generateReadme (docMD: string, config: Config, pkg: Packag
240240
});
241241
});
242242
const shield = {
243-
version: `![Client Version: ${pkg.version}](https://img.shields.io/badge/Client%20Version-${pkg.version}-%2316a34a)`,
243+
version: `[![npm](https://img.shields.io/npm/v/cloudnode-ts)](https://www.npmjs.com/package/cloudnode-ts)`,
244244
apiVersion: `![API Version: ${config.apiVersion}](https://img.shields.io/badge/API%20Version-${config.apiVersion}-%232563eb)`,
245245
build: `![build: ${buildStatus ? "passing" : "failing"}](https://img.shields.io/badge/build-${buildStatus ? "passing" : "failing"}-%23${buildStatus ? "16a34a" : "dc2626"})`,
246-
downloads: `![npm downloads](https://img.shields.io/npm/dt/cloudnode-ts?label=downloads)`
246+
codeQl: "[![CodeQL](https://github.com/cloudnode-pro/ts-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/cloudnode-pro/ts-client/actions/workflows/github-code-scanning/codeql)",
247+
downloads: `[![npm downloads](https://img.shields.io/npm/dt/cloudnode-ts?label=downloads)](https://www.npmjs.com/package/cloudnode-ts)`,
247248
};
248249
const rendered = Mustache.render(template, {config, pkg, docMD, shield});
249250
await fs.writeFile("README.md", rendered);

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "cloudnode-ts",
3-
"version": "3.0.0",
3+
"version": "0.0.0-dev",
44
"description": "A client library for the Cloudnode API, written in TypeScript. [Documentation](https://github.com/cloudnode-pro/ts-client#documentation)",
55
"main": "src/Cloudnode.js",
66
"type": "module",
77
"scripts": {
88
"test": "echo \"Error: no test specified\" && exit 1",
99
"build": "tsc",
1010
"generate": "./scripts/generate.sh",
11-
"readme": "node ./gen/readme.js",
12-
"tag": "node scripts/tag"
11+
"readme": "node ./gen/readme.js"
1312
},
1413
"repository": {
1514
"type": "git",

scripts/tag.js

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/Cloudnode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Cloudnode {
3535
/**
3636
* Client user agent
3737
*/
38-
#userAgent = `cloudnode/2.1.0`;
38+
#userAgent = `cloudnode/0.0.0-dev`;
3939
/**
4040
* Construct a new Cloudnode API client
4141
* @param token API token to use for requests

0 commit comments

Comments
 (0)