Skip to content

Commit 9957b6a

Browse files
authored
Merge pull request #187
ci: only package artifacts on manual trigger (nativeshims)
2 parents 443e7c7 + 663a509 commit 9957b6a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/build-nativeshims.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,31 @@ jobs:
117117
attestations: write
118118
runs-on: windows-2019
119119
needs: [build-windows, build-linux-amd64, build-linux-arm64, build-macos]
120+
env:
121+
PACKAGE_VERSION: ${{ github.event.inputs.version != '' && github.event.inputs.version || '1.0.0' }}
122+
GITHUB_REPO_URL: https://github.com/${{ github.repository }}
120123
steps:
121-
- uses: actions/download-artifact@v4
124+
- name: Download contents, set metadata and package
125+
uses: actions/download-artifact@v4
122126
- run: |
123127
mv nuspec/*.nuspec .
124128
mv nuspec/readme.md .
125129
$nuspec = [xml](gc Yubico.NativeShims.nuspec)
126130
$repo = $nuspec.CreateElement("repository")
127-
$repo.SetAttribute("url","https://github.com/${{ github.repository }}")
131+
$repo.SetAttribute("url","$env:GITHUB_REPO_URL")
128132
$repo.SetAttribute("type","git")
129133
$nuspec.package.metadata.AppendChild($repo)
130-
$nuspec.package.metadata.version = "${{ github.event.inputs.version }}"
134+
$repo.SetAttribute("url","$env:GITHUB_REPO_URL")
131135
$nuspec.Save("Yubico.NativeShims.nuspec")
132136
cat Yubico.NativeShims.nuspec
133137
- run: nuget pack Yubico.NativeShims.nuspec
134-
- uses: actions/upload-artifact@v4
138+
139+
- name: Upload Nuget Package
140+
uses: actions/upload-artifact@v4
135141
with:
136142
name: NuGet Package NativeShims
137143
path: Yubico.NativeShims.*.nupkg
138-
144+
139145
- name: Generate artifact attestation
140146
uses: actions/attest-build-provenance@v2
141147
with:
@@ -159,4 +165,4 @@ jobs:
159165
name: Yubico.NativeShims.nupkg
160166
- run: |
161167
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
162-
dotnet nuget push Yubico.NativeShims.*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
168+
dotnet nuget push Yubico.NativeShims.*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)