1313
1414jobs :
1515
16- build :
16+ test :
1717
1818 runs-on : windows-latest
1919
@@ -27,40 +27,82 @@ jobs:
2727 shell : pwsh
2828 run : dotnet test -c Release
2929
30+
31+ publish-nuget-pacakge :
32+ needs : test
33+
34+ runs-on : windows-latest
35+
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v2
39+ with :
40+ fetch-depth : 0
41+
42+ - name : Restore
43+ shell : pwsh
44+ run : dotnet restore .\Tocsoft.GraphQLCodeGen.MsBuild\Tocsoft.GraphQLCodeGen.MsBuild.csproj
45+
3046 - name : Package
3147 shell : pwsh
32- run : dotnet pack -c Release -o packages
48+ run : dotnet pack .\Tocsoft.GraphQLCodeGen.MsBuild\Tocsoft.GraphQLCodeGen.MsBuild.csproj -c Release -o packages
3349
3450 - uses : actions/upload-artifact@v2
3551 with :
3652 name : application
37- path : packages/*.*
53+ path : nuget/*.*
54+
55+ - name : Publish the package to GPR
56+ shell : pwsh
57+ run : dotnet nuget push packages/*.nupkg -s https://nuget.pkg.github.com/tocsoft/index.json -k ${{secrets.GITHUB_TOKEN}}
58+
59+ - name : Publish the package to nuget.org
60+ if : github.event_name == 'release' && github.event.action == 'created'
61+ shell : pwsh
62+ run : dotnet nuget push packages/*.nupkg -k ${{secrets.NUGET_TOKEN}}
63+
64+ publish-npm-pacakge :
65+ needs : test
66+
67+ runs-on : windows-latest
68+
69+ steps :
70+ - name : Checkout
71+ uses : actions/checkout@v2
72+ with :
73+ fetch-depth : 0
3874
39- # publish to github pacakge repository
40- - uses : actions/setup-node@v2
75+ - name : Restore
76+ shell : pwsh
77+ run : dotnet restore .\Tocsoft.GraphQLCodeGen.Npm\Tocsoft.GraphQLCodeGen.Npm.csproj
78+
79+ - name : Package
80+ shell : pwsh
81+ run : dotnet pack .\Tocsoft.GraphQLCodeGen.Npm\Tocsoft.GraphQLCodeGen.Npm.csproj -c Release -o packages
82+
83+ - uses : actions/upload-artifact@v2
4184 with :
42- node-version : ' 12.x'
43- registry-url : ' https://npm.pkg.github.com'
85+ name : application
86+ path : npm/*.*
87+
88+ - name : Configure Github package registry
89+ shell : pwsh
90+ run : Set-Content -Path '.npmrc' -Value 'registry=https://npm.pkg.github.com'
4491
45- - run : npm publish packages/*.tgz
92+ - name : Publish npm package to Github package registry
93+ shell : pwsh
94+ run : npm publish packages/*.tgz
4695 env :
4796 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4897
49- - name : Publish the package to GPR
50- run : dotnet nuget push packages/*.nupkg -s https://nuget.pkg.github.com/tocsoft/index.json -k ${{secrets.GITHUB_TOKEN}}
51-
52-
53- # publish to npm & nuget
54- - uses : actions/setup-node@v1
98+ - name : Configure npmjs package registry
5599 if : github.event_name == 'release' && github.event.action == 'created'
56- with :
57- node-version : ' 10.x'
58- registry-url : ' https://registry.npmjs.org'
59- - run : npm publish packages/*.tgz --access public
100+ shell : pwsh
101+ run : Set-Content -Path '.npmrc' -Value 'registry=https://registry.npmjs.org'
102+
103+ - name : Publish npm package to Npmjs package registry
104+ shell : pwsh
105+ run : npm publish packages/*.tgz --access public
60106 if : github.event_name == 'release' && github.event.action == 'created'
61107 env :
62- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
63-
64- - name : Publish the package to nuget.org
65- if : github.event_name == 'release' && github.event.action == 'created'
66- run : dotnet nuget push packages/*.nupkg -k ${{secrets.NUGET_TOKEN}}
108+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments