Skip to content

Commit 5db8a90

Browse files
authored
chore: upgrade to the latest dnt and publish on tag (#38)
1 parent 24dd0bf commit 5db8a90

File tree

5 files changed

+49
-39
lines changed

5 files changed

+49
-39
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,21 @@ jobs:
1212
deno-version: v1.x
1313
- name: Run tests
1414
run: deno test
15+
16+
- name: Get tag version
17+
if: startsWith(github.ref, 'refs/tags/')
18+
id: get_tag_version
19+
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: '14.x'
23+
registry-url: 'https://registry.npmjs.org'
24+
- name: npm build
25+
run: deno run --allow-read --allow-write=./npm --allow-net --allow-run --no-check ./scripts/build_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
26+
- name: npm publish
27+
if: startsWith(github.ref, 'refs/tags/')
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
run: |
31+
cd npm
32+
npm publish

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/node_modules
22
*.js.map
3-
npm/dist
4-
npm/LICENSE
3+
npm

build_npm.ps1

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

npm/package.json

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

scripts/build_npm.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { build } from "https://deno.land/x/[email protected]/mod.ts";
2+
3+
await build({
4+
entryPoint: "mod.ts",
5+
typeCheck: true,
6+
outDir: "./npm",
7+
package: {
8+
name: "code-block-writer",
9+
version: Deno.args[0] ?? "0.0.0",
10+
description: "A simple code writer that assists with formatting and visualizing blocks of code.",
11+
repository: {
12+
type: "git",
13+
url: "git+https://github.com/dsherret/code-block-writer.git",
14+
},
15+
keywords: [
16+
"code generation",
17+
"typescript",
18+
"writer",
19+
"printer",
20+
],
21+
author: "David Sherret",
22+
license: "MIT",
23+
bugs: {
24+
url: "https://github.com/dsherret/code-block-writer/issues",
25+
},
26+
homepage: "https://github.com/dsherret/code-block-writer#readme",
27+
},
28+
});
29+
30+
Deno.copyFileSync("LICENSE", "npm/LICENSE");

0 commit comments

Comments
 (0)