Skip to content

Commit f25c292

Browse files
committed
Separate sign action from publish
1 parent d626baf commit f25c292

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Set path for nektos/act
29-
if: ${{ runner.os == 'Windows' && env.ACT }}
29+
if: ${{ runner.os == 'Windows' && env.ACT }}
3030
run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH
3131
shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}'
3232

@@ -115,14 +115,16 @@ jobs:
115115
path: reports/coverage
116116
if: steps.codecov.outcome == 'success'
117117
- name: Pack
118+
if: ${{ runner.os != 'Windows' }}
118119
run: dotnet pack --configuration Release -o packages --no-build
119120
- name: Upload artifacts (.nupkg)
121+
if: ${{ runner.os != 'Windows' }}
120122
uses: actions/upload-artifact@v4
121123
with:
122-
name: packages_${{ matrix.os }}
124+
name: packages
123125
path: packages/
124126

125-
publish:
127+
sign:
126128
needs: build
127129
runs-on: windows-latest
128130
defaults:
@@ -131,7 +133,7 @@ jobs:
131133

132134
steps:
133135
- name: Set path for nektos/act
134-
if: ${{ runner.os == 'Windows' && env.ACT }}
136+
if: ${{ runner.os == 'Windows' && env.ACT }}
135137
run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH
136138
shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}'
137139

@@ -162,26 +164,18 @@ jobs:
162164
- name: Download Package artifact
163165
uses: actions/download-artifact@v4
164166

165-
- run: |
166-
if [ -d "packages_ubuntu-latest" ]
167-
then
168-
mv packages_ubuntu-latest packages
169-
else
170-
mv packages_windows-latest packages
171-
fi
172-
173167
- name: Install sign tool
174168
env:
175169
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNER_CLIENT_SECRET }}
176170
run: dotnet tool install sign --tool-path . --version 0.9.1-beta.25157.1
177-
if: ${{ env.AZURE_CLIENT_SECRET != '' && github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' }}
171+
if: ${{ env.AZURE_CLIENT_SECRET != '' && github.ref == 'refs/heads/master' }}
178172

179173
- name: Sign
180174
env:
181175
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
182176
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNER_CLIENT_SECRET }}
183177
AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNER_CLIENT_ID }}
184-
if: ${{ env.AZURE_CLIENT_SECRET != '' && github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' }}
178+
if: ${{ env.AZURE_CLIENT_SECRET != '' && github.ref == 'refs/heads/master' }}
185179
run: |
186180
./sign code trusted-signing \
187181
--base-directory "${{ github.workspace }}/packages" \
@@ -191,6 +185,37 @@ jobs:
191185
--trusted-signing-certificate-profile "${{ secrets.TRUSTED_SIGNING_CERTIFICATE_PROFILE }}" \
192186
-v trace
193187
188+
- name: Upload artifacts (.nupkg)
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: packages-signed
192+
path: packages/
193+
194+
publish:
195+
needs: sign
196+
runs-on: ubuntu-latest
197+
198+
steps:
199+
- name: Set path for nektos/act
200+
if: ${{ runner.os == 'Windows' && env.ACT }}
201+
run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH
202+
shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}'
203+
204+
- name: Setup .NET
205+
if: ${{ runner.os != 'Windows' || !env.ACT }}
206+
uses: actions/setup-dotnet@v4
207+
with:
208+
dotnet-version: |
209+
8.0.x
210+
211+
- name: Download Package artifact
212+
uses: actions/download-artifact@v4
213+
with:
214+
name: packages-signed
215+
216+
- run: |
217+
ls -alR
218+
194219
- name: Push to MyGet
195220
env:
196221
MYGET_PUSH_KEY: ${{ secrets.MYGET_PUSH_KEY }}

0 commit comments

Comments
 (0)