Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup automated NPM package publishing #30

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deno-test.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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;
};