Skip to content

Commit

Permalink
Specify shell in Github Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbukin committed Dec 1, 2021
1 parent 1a53e6d commit 3148d01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
ref: ${{ github.sha }}
- name: Get source branch version
id: source-version
shell: bash
run: |
version_prefix=$(cat ./src/Directory.Build.props | grep "<VersionPrefix>" | sed -e "s/ *<\/*VersionPrefix>//g")
version_suffix=$(cat ./src/Directory.Build.props | grep "<VersionSuffix>" | sed -e "s/ *<\/*VersionSuffix>//g")
Expand All @@ -39,6 +40,7 @@ jobs:
ref: ${{ github.base_ref }}
- name: Get target branch version
id: target-version
shell: bash
run: |
version_prefix=$(cat ./src/Directory.Build.props | grep "<VersionPrefix>" | sed -e "s/ *<\/*VersionPrefix>//g")
version_suffix=$(cat ./src/Directory.Build.props | grep "<VersionSuffix>" | sed -e "s/ *<\/*VersionSuffix>//g")
Expand All @@ -63,6 +65,7 @@ jobs:
with:
ref: ${{ github.sha }}
- name: Compare versions
shell: bash
run: |
dotnet publish -c Release ./tools/Dodo.Primitives.Tools.CompareVersions/Dodo.Primitives.Tools.CompareVersions.csproj
source_more_than_target=$(dotnet ./tools/Dodo.Primitives.Tools.CompareVersions/bin/Release/net6.0/publish/Dodo.Primitives.Tools.CompareVersions.dll "${source_version}" "${target_version}")
Expand Down Expand Up @@ -119,6 +122,7 @@ jobs:
with:
dotnet-version: 6.0.100
- name: Run tests
shell: pwsh
run: |
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f net462 /p:CoverletOutput=../../coverage/cover_netstandard20 /p:CoverletOutputFormat=json
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f netcoreapp3.1 /p:CoverletOutput=../../coverage/cover_netcoreapp31 /p:MergeWith=../../coverage/cover_netstandard20.net462.json /p:CoverletOutputFormat=json
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/push_to_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ref: ${{ github.sha }}
- name: Validate version
id: validate-version
shell: bash
run: |
version_prefix=$(cat ./src/Directory.Build.props | grep "<VersionPrefix>" | sed -e "s/ *<\/*VersionPrefix>//g")
version_suffix=$(cat ./src/Directory.Build.props | grep "<VersionSuffix>" | sed -e "s/ *<\/*VersionSuffix>//g")
Expand Down Expand Up @@ -57,6 +58,7 @@ jobs:
with:
dotnet-version: 6.0.100
- name: Run tests
shell: pwsh
run: |
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f net462 /p:CoverletOutput=../../coverage/cover_netstandard20 /p:CoverletOutputFormat=json
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f netcoreapp3.1 /p:CoverletOutput=../../coverage/cover_netcoreapp31 /p:MergeWith=../../coverage/cover_netstandard20.net462.json /p:CoverletOutputFormat=json
Expand All @@ -79,6 +81,7 @@ jobs:
ref: ${{ github.sha }}
- name: Extract version
id: extract-version
shell: bash
run: |
version_prefix=$(cat ./src/Directory.Build.props | grep "<VersionPrefix>" | sed -e "s/ *<\/*VersionPrefix>//g")
version_suffix=$(cat ./src/Directory.Build.props | grep "<VersionSuffix>" | sed -e "s/ *<\/*VersionSuffix>//g")
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
with:
dotnet-version: 6.0.100
- name: Run tests
shell: pwsh
run: |
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f net462 /p:CoverletOutput=../../coverage/cover_netstandard20 /p:CoverletOutputFormat=json
dotnet test -c Release ./src/Dodo.Primitives.Tests/Dodo.Primitives.Tests.csproj /p:CollectCoverage=true -f netcoreapp3.1 /p:CoverletOutput=../../coverage/cover_netcoreapp31 /p:MergeWith=../../coverage/cover_netstandard20.net462.json /p:CoverletOutputFormat=json
Expand All @@ -38,13 +39,17 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/cover_full.net6.0.info
- name: Build and publish library to NuGet
shell: pwsh
run: |
dotnet publish ./src/Dodo.Primitives/Dodo.Primitives.csproj -c Release -f netcoreapp3.1
dotnet publish ./src/Dodo.Primitives/Dodo.Primitives.csproj -c Release -f netstandard2.0
dotnet publish ./src/Dodo.Primitives/Dodo.Primitives.csproj -c Release -f net5.0
dotnet publish ./src/Dodo.Primitives/Dodo.Primitives.csproj -c Release -f net6.0
dotnet pack -c Release --no-restore --no-build --output out/ ./src/Dodo.Primitives/Dodo.Primitives.csproj
dotnet nuget push (Get-ChildItem ./out/ -Filter *.symbols.nupkg | Select-Object -First 1 | % { $_.FullName }) --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
dotnet pack -c Release --no-restore --no-build --output out/tmp ./src/Dodo.Primitives/Dodo.Primitives.csproj
(Get-Item (Get-ChildItem ./out/tmp -Filter *.symbols.nupkg | Select-Object -First 1 | % { $_.FullName })) | Move-Item -Destination { $_.Directory.Parent.FullName }
Remove-Item ./out/tmp -Force -Recurse
Get-Item (Get-ChildItem ./out/ -Filter *.nupkg | Select-Object -First 1 | % { $_.FullName }) | Rename-Item -NewName {$_.name -replace ".symbols.nupkg",".nupkg"}
dotnet nuget push (Get-ChildItem ./out/ -Filter *.nupkg | Select-Object -First 1 | % { $_.FullName }) --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
- uses: actions/upload-artifact@v2
with:
name: NuGet package
Expand All @@ -60,6 +65,7 @@ jobs:
path: out
- name: Get package
id: get-package
shell: bash
run: |
echo "::set-output name=package::$(ls out/)"
- name: Upload release assets
Expand Down

0 comments on commit 3148d01

Please sign in to comment.