mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
ci(npm): publish to npm on tag creation (#1997)
* Create npm.yml * fix invalid on * Update dnt.ts * Update npm.yml
This commit is contained in:
33
.github/workflows/npm.yml
vendored
Normal file
33
.github/workflows/npm.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: NPM Publish
|
||||
|
||||
on:
|
||||
create:
|
||||
tags:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
deno: ["v1.x"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: ${{ matrix.deno }}
|
||||
# Taken from: https://github.com/denoland/dnt#github-actions---npm-publish-on-tag
|
||||
- name: Get tag version
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
id: get_tag_version
|
||||
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- name: npm build
|
||||
run: deno run -A ./dnt.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
|
||||
- name: npm publish
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: cd npm && npm publish
|
||||
3
dnt.ts
3
dnt.ts
@@ -1,5 +1,4 @@
|
||||
import { build } from "https://deno.land/x/dnt@0.7.3/mod.ts";
|
||||
import { DISCORDENO_VERSION } from "./mod.ts";
|
||||
|
||||
await Deno.remove("npm", { recursive: true }).catch((_) => {});
|
||||
|
||||
@@ -11,7 +10,7 @@ await build({
|
||||
test: false,
|
||||
package: {
|
||||
name: "discordeno",
|
||||
version: DISCORDENO_VERSION,
|
||||
version: Deno.args[0],
|
||||
},
|
||||
compilerOptions: { target: "ES2020" },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user