Skip to content

Commit

Permalink
Setup automated NPM package publishing (#30)
Browse files Browse the repository at this point in the history
Resolves #2
  • Loading branch information
karelklima committed Oct 3, 2022
1 parent 8a3b5a7 commit 7d5f59a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deno-test.yml
Expand Up @@ -20,3 +20,4 @@ jobs:
- run: deno task fmt:check
- run: deno task lint
- run: deno task test
- run: deno task dnt
33 changes: 24 additions & 9 deletions .github/workflows/npm-publish.yml
@@ -1,25 +1,40 @@
# This workflow will run tests using node and then publish packages to NPM Packages when a release is created
# This workflow will run DNT and then publish to NPM when a tag is created

name: Publish Node.js Packages
name: Publish to NPM

on:
#release:
# types: [created]
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
publish:
dnt-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm run build
- run: npm run set-version ${{ github.event.release.tag_name }}
- run: npm run publish

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- uses: actions/github-script@v4
id: version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
- run: deno task dnt ${{ steps.version.outputs.no-v }}
- run: npm publish --access public
working-directory: ./npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion library/namespaces/namespace.ts
Expand Up @@ -33,7 +33,7 @@ export const createNamespace = <
$prefix: namespaceSpec["prefix"],
$iri: namespaceSpec["iri"],
},
) as O & {
) as unknown as O & {
$prefix: P;
$iri: I;
};

0 comments on commit 7d5f59a

Please sign in to comment.