@@ -2,43 +2,58 @@ name: CI/CD
22
33on :
44 push :
5+ branches :
6+ - main
57 paths-ignore :
68 - README.md
79 - .gitignore
810 - .prettierignore
911 pull_request :
1012 workflow_dispatch :
1113
14+ concurrency :
15+ group : cicd-${{ github.ref }}
16+ cancel-in-progress : true
17+
1218jobs :
1319 build :
1420 runs-on : ubuntu-latest
1521 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
1828 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
2336 if : startsWith(github.ref, 'refs/tags/v')
2437 run : echo "::set-output name=version::${GITHUB_REF##refs/tags/v}"
38+
2539 - name : Publish NPM package
2640 if : startsWith(github.ref, 'refs/tags/v')
2741 env :
28- NPM_TOKEN : ${{secrets.NPM_TOKEN}}
42+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
2943 run : |
30- npm version --no-git-tag-version " ${{steps.version.outputs.version}}"
44+ npm version --no-git-tag-version ' ${{ steps.version.outputs.version }}'
3145 echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
3246 npm publish --access public
33- rm .npmrc
47+ rm .npmrc
48+
3449 - name : Github Release
3550 if : startsWith(github.ref, 'refs/tags/v')
3651 uses : actions/create-release@v1
3752 env :
38- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
53+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3954 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 }}
4257 body : |
4358 ## 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