@@ -2,43 +2,58 @@ name: CI/CD
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - main
5
7
paths-ignore :
6
8
- README.md
7
9
- .gitignore
8
10
- .prettierignore
9
11
pull_request :
10
12
workflow_dispatch :
11
13
14
+ concurrency :
15
+ group : cicd-${{ github.ref }}
16
+ cancel-in-progress : true
17
+
12
18
jobs :
13
19
build :
14
20
runs-on : ubuntu-latest
15
21
steps :
16
- - uses : actions/checkout@v2
17
- - name : Build and test
22
+ - uses : actions/checkout@v3
23
+ - uses : actions/setup-node@v3
24
+ with :
25
+ node-version-file : .nvmrc
26
+
27
+ - name : Install & Build & Test
18
28
run : |
19
- yarn
20
- yarn run build
21
- yarn run codegen
22
- - id : version
29
+ corepack enable
30
+ pnpm install --frozen-lockfile --strict-peer-dependencies
31
+ pnpm run build
32
+ pnpm run gen
33
+
34
+ - name : Compute package version
35
+ id : version
23
36
if : startsWith(github.ref, 'refs/tags/v')
24
37
run : echo "::set-output name=version::${GITHUB_REF##refs/tags/v}"
38
+
25
39
- name : Publish NPM package
26
40
if : startsWith(github.ref, 'refs/tags/v')
27
41
env :
28
- NPM_TOKEN : ${{secrets.NPM_TOKEN}}
42
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
29
43
run : |
30
- npm version --no-git-tag-version " ${{steps.version.outputs.version}}"
44
+ npm version --no-git-tag-version ' ${{ steps.version.outputs.version }}'
31
45
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
32
46
npm publish --access public
33
- rm .npmrc
47
+ rm .npmrc
48
+
34
49
- name : Github Release
35
50
if : startsWith(github.ref, 'refs/tags/v')
36
51
uses : actions/create-release@v1
37
52
env :
38
- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
53
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39
54
with :
40
- tag_name : v${{steps.version.outputs.version}}
41
- release_name : v${{steps.version.outputs.version}}
55
+ tag_name : v${{ steps.version.outputs.version }}
56
+ release_name : v${{ steps.version.outputs.version }}
42
57
body : |
43
58
## NPM Package
44
- https://www.npmjs.com/package/graphql-codegen-golang/v/${{steps.version.outputs.version}}
59
+ https://www.npmjs.com/package/graphql-codegen-golang/v/${{ steps.version.outputs.version }}
0 commit comments