-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (82 loc) · 2.99 KB
/
build.yml
File metadata and controls
107 lines (82 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build
on:
push:
branches:
- master
- main
pull_request:
branches:
- "*"
release:
types: [created]
jobs:
test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Test
shell: pwsh
run: dotnet test -c Release
publish-nuget-pacakge:
needs: test
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore
shell: pwsh
run: dotnet restore
- name: Package
shell: pwsh
run: dotnet pack .\Tocsoft.GraphQLCodeGen.MsBuild\Tocsoft.GraphQLCodeGen.MsBuild.csproj -c Release -o packages
- uses: actions/upload-artifact@v2
with:
name: nuget
path: packages/*.nupkg
- name: Publish the package to GPR
if: (github.event_name != 'pull_request')
shell: pwsh
run: dotnet nuget push "$((Resolve-Path packages/*.nupkg).Path)" -s https://nuget.pkg.github.com/tocsoft/index.json -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate
- name: Publish the package to nuget.org
if: github.event_name == 'release' && github.event.action == 'created'
shell: pwsh
run: dotnet nuget push "$((Resolve-Path packages/*.nupkg).Path)" -k ${{secrets.NUGET_TOKEN}} --skip-duplicate --source https://api.nuget.org/v3/index.json
publish-npm-package:
needs: test
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore
shell: pwsh
run: dotnet restore
- name: Package
shell: pwsh
run: dotnet pack .\Tocsoft.GraphQLCodeGen.Npm\Tocsoft.GraphQLCodeGen.Npm.csproj -c Release -o packages
- uses: actions/upload-artifact@v2
with:
name: npm
path: packages/*.tgz
- name: Configure authenticate bintray
if: (github.event_name != 'pull_request')
shell: pwsh
run: Set-Content -Path '.npmrc' -Value "${{ secrets.BINTRAY_NPMRC }}"
- name: Publish npm package to bintray
if: (github.event_name != 'pull_request')
shell: pwsh
run: npm publish "$((Resolve-Path packages/*.tgz).Path)" --registry https://api.bintray.com/npm/tocsoft/npm
- name: Configure npmjs package registry
if: github.event_name == 'release' && github.event.action == 'created'
shell: pwsh
run: Set-Content -Path '.npmrc' -Value "${{ secrets.NPMJS_NPMRC }}"
- name: Publish npm package to Npmjs package registry
if: github.event_name == 'release' && github.event.action == 'created'
shell: pwsh
run: npm publish "$((Resolve-Path packages/*.tgz).Path)" --access public --registry https://registry.npmjs.org/