Skip to content

Commit

Permalink
CI: add publish
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed May 4, 2022
1 parent 5559f0a commit 1d02f01
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: publish
on:
release:
types: [ created ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm install --force

- name: Build
run: npm run build --if-present

publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
registry-url: "https://registry.npmjs.org"

- name: Publish
run: npm install && npm run build --if-present && npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
.idea
node_modules
build
package

# ================= mistake commit prevent ================= #
# test bot config
test/config.json

# source js
src/*.js
src/**/*.js
src/**/*.map

# test js
test/*.js
test/**/*.js
test/**/*.map
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!package
src
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "discordp",
"version": "1.0.1",
"main": "src/Client.ts",
"version": "1.1.0",
"main": "package/Client.d.ts",
"author": "PleahMaCaka",
"license": "MIT",
"bugs": "https://github.com/PleahMaCaka/discordp/issues",
Expand Down Expand Up @@ -32,6 +32,7 @@
"url": "git+https://github.com/PleahMaCaka/discordp.git"
},
"scripts": {
"build": "tsc"
"build": "tsc",
"test:bot": "yarn build && ts-node test/bot.ts"
}
}
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"outDir": "build",
"outDir": "package",
"sourceMap": false,
"declaration": true
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
"src/**/*.ts"
],
"exclude": [
"node_modules"
"node_modules",
"test/**/*.ts"
]
}

0 comments on commit 1d02f01

Please sign in to comment.