Skip to content

Commit 7c1b3fe

Browse files
committed
Setup publish workflow
1 parent 9c0605e commit 7c1b3fe

File tree

5 files changed

+55
-17
lines changed

5 files changed

+55
-17
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish NPM Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish on NPM
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Setup node
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 14
18+
registry-url: https://registry.npmjs.org/
19+
20+
- name: Setup Git
21+
run: |
22+
git config --local user.email "$(git log --format='%ae' HEAD^!)"
23+
git config --local user.name "$(git log --format='%an' HEAD^!)"
24+
25+
- run: yarn install
26+
- run: yarn build
27+
28+
- name: Publish build from ${{ github.ref }}
29+
run: |
30+
version=$(echo $TAG | grep -o -E "[0-9.]+")
31+
git tag -d "v${version}"
32+
yarn publish --new-version $version ./lib
33+
env:
34+
TAG: ${{ github.ref }}
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/tests.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ on:
88

99
jobs:
1010
build:
11+
name: Build
1112
runs-on: ubuntu-latest
1213

13-
strategy:
14-
matrix:
15-
node-version: [12.x, 14.x]
16-
1714
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v1
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Setup node
18+
uses: actions/setup-node@v2
2019
with:
21-
node-version: ${{ matrix.node-version }}
20+
node-version: 14
2221

2322
- run: yarn install
24-
- run: yarn run build
23+
- run: yarn build
2524
- run: yarn test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ generates:
4747
- add:
4848
content: "/** Generated File. Do not modify directly. */"
4949
- typescript-operations
50-
- typescript-graphql-typed-files-modules/lib/plugin
50+
- typescript-graphql-typed-files-modules
5151
config:
5252
skipTypename: true
5353
```

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
{
2-
"name": "apollo-typed-documents",
3-
"version": "2.0.0",
4-
"description": "Get type safety for your apollo documents.",
2+
"name": "typescript-graphql-typed-files-modules",
3+
"version": "0.0.1",
4+
"author": "Eric Matte <[email protected]>",
5+
"description": "Get type safety for your graphql documents.",
56
"keywords": [
67
"module",
78
"graphql",
89
"graphql-loader",
910
"codegen"
1011
],
1112
"license": "MIT",
12-
"main": "lib/plugin.js",
13+
"main": "index.js",
1314
"files": [
1415
"lib"
1516
],
1617
"scripts": {
17-
"build": "rimraf lib && tsc",
18-
"preversion": "yarn test",
19-
"version": "yarn run build",
20-
"postversion": "git push && git push --tags",
18+
"build": "rimraf lib && tsc && cp package.json lib/package.json",
19+
"postversion": "git push --tags -f",
2120
"test": "jest"
2221
},
2322
"dependencies": {

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { plugin } from "./plugin";
2+
3+
export { plugin };
4+
5+
export default plugin;

0 commit comments

Comments
 (0)