Skip to content

Commit 4263922

Browse files
authored
Use set-version action in dotnet release action (#296)
1 parent 6db41fa commit 4263922

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/release-dotnet.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,18 @@ jobs:
3232
- uses: actions/setup-dotnet@v1
3333
with:
3434
dotnet-version: '6.0.x'
35-
- name: Generate Package Version
36-
run: |
37-
$json = Invoke-WebRequest 'https://api.github.com/repos/trinsic-id/okapi/releases/latest' `
38-
-Headers @{ "Authorization" = "Token $env:API_GITHUB_TOKEN"} | ConvertFrom-Json
39-
$version = $json.tag_name.Trim("v")
40-
echo "PACKAGE_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
41-
shell: pwsh
42-
env:
43-
API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}
35+
- uses: trinsic-id/[email protected]
36+
id: setversion
37+
with:
38+
githubToken: ${{ secrets.API_GITHUB_TOKEN }}
39+
overrideVersion: ${{ github.event.inputs.packageVersion }}
4440

4541
- name: Create Nuget package
4642
run: |
4743
dotnet workload install ios
4844
dotnet restore
4945
dotnet build -c Release
50-
dotnet pack -p:SkipNativeLibsCopy=true -p:Configuration=Release -p:PackageVersion=$env:PACKAGE_VERSION
46+
dotnet pack -p:SkipNativeLibsCopy=true -p:Configuration=Release -p:PackageVersion=${{ steps.setversion.outputs.packageVersion }}
5147
shell: pwsh
5248
working-directory: ./dotnet/Library/Okapi
5349

@@ -72,8 +68,8 @@ jobs:
7268
name: nuget
7369
- name: Push packages to Nuget
7470
run: |
75-
foreach ($item in get-childitem ./ -recurse | select-object FullName | where { $_.FullName.EndsWith("nupkg") })
71+
foreach ($item in get-childitem ./ -recurse | select-object FullName | where { $_.FullName.EndsWith(".nupkg") })
7672
{
77-
nuget push $item.FullName -ApiKey "${{ secrets.NUGET_API_KEY }}" -Source https://api.nuget.org/v3/index.json -SkipDuplicate
73+
nuget push $item.FullName -ApiKey "${{ secrets.NUGET_API_KEY }}" -Source https://api.nuget.org/v3/index.json
7874
}
7975
shell: pwsh

0 commit comments

Comments
 (0)