Skip to content

Commit 57a3a5c

Browse files
committed
CI
1 parent da8899c commit 57a3a5c

File tree

3 files changed

+71
-4
lines changed

3 files changed

+71
-4
lines changed

.github/workflows/npmpublish.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Node.js Package
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches:
10+
- master
11+
- develop
12+
13+
jobs:
14+
prepush-and-build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v1
18+
- uses: actions/setup-node@v1
19+
with:
20+
node-version: 12
21+
- name: Yarn install
22+
run: yarn install
23+
- name: Runing prepush
24+
run: npm run pre-push
25+
- name: Archive production artifacts
26+
uses: actions/upload-artifact@v1
27+
with:
28+
name: dist
29+
path: dist
30+
31+
publish:
32+
needs: prepush-and-build
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-node@v1
37+
with:
38+
node-version: 12
39+
- name: Download 'dist' from the previous Job
40+
uses: actions/download-artifact@v1
41+
with:
42+
name: dist
43+
- name: Set GIT username & email
44+
run: git config --global user.name 'GIT Workflow CI' && git config --global user.email [email protected]
45+
- run: npm version patch -m 'Update package version version to %s'
46+
- name: Generate public package.json
47+
run: npm run gen-public-package.json
48+
- name: Generate public README.md
49+
run: cp README.md dist/
50+
- name: NPM Authentication
51+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
52+
env:
53+
NPM_TOKEN: ${{secrets.npm_token}}
54+
- run: npm publish dist --access public
55+
- run: git push --no-verify & git push --tags --no-verify

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "wallaby-ts-webpack",
3-
"description": "",
4-
"license": "MIT",
2+
"name": "@z-brain/typeorm-postgres-naming-strategy",
3+
"description": "Pascal/Camel Case naming for everything in the PostgreSQL",
4+
"license": "GPL-3.0",
55
"private": true,
66
"version": "1.0.0",
77
"bugs": {
@@ -28,7 +28,8 @@
2828
"test:watch": "npm run test -- --watch",
2929
"tpl-repo": "tools/merge-with-repository-template.sh",
3030
"tpl-repo:check": "npm run tpl-repo -- check",
31-
"tpl-repo:merge": "npm run tpl-repo -- merge"
31+
"tpl-repo:merge": "npm run tpl-repo -- merge",
32+
"gen-public-package.json": "tools/gen-public-package.js"
3233
},
3334
"dependencies": {
3435
"@types/lodash": "^4.14.0",

tools/gen-public-package.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
const root = path.join.bind(path, __dirname, '..');
7+
8+
// eslint-disable-next-line import/no-dynamic-require
9+
const { scripts, husky, devDependencies, ...packageJson } = require(root('package.json'));
10+
const packageJsonStr = JSON.stringify(packageJson, null, 2);
11+
fs.writeFileSync(root('dist', 'package.json'), packageJsonStr);

0 commit comments

Comments
 (0)