Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JadynWong committed Mar 5, 2021
1 parent cc40305 commit 000cb41
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 12 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: .NET Core

on: [push]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
Expand All @@ -9,13 +13,20 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core

- name: Install libicu-dev
run: sudo apt-get update;sudo apt-get install libicu-dev -y

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.103
dotnet-version: '5.0.x'

- name: Build with dotnet
run: dotnet build --configuration Release

- name: Test with dotnet
run: dotnet test --configuration Release
run: dotnet test --configuration Release --no-build

- name: Pack with dotnet
run: dotnet pack --configuration Release
run: dotnet pack --configuration Release --no-build
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.103
dotnet-version: '5.0.x'

- name: Build project
shell: powershell
run: |
.\Build.ps1 -version ${{ steps.get_version.outputs.VERSION }} -nugetKey ${{ secrets.NugetKey }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync_qqwry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:

# Runs a single command using the runners shell
- name: Run download script
shell: powershell
run: ./download.ps1

# Runs a set of commands using the runners shell
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Sample/bin/Debug/netcoreapp2.2/Sample.dll",
"program": "${workspaceFolder}/Sample/bin/Debug/net5/Sample.dll",
"args": [],
"cwd": "${workspaceFolder}/Sample",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
Expand Down
31 changes: 27 additions & 4 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,45 @@ param(
[string]$nugetKey
)

$solutionPath = ".\QQWrySln.sln"
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
$outputFolder = (Join-Path $rootFolder "artifacts")
if (Test-Path $outputFolder) { Remove-Item $outputFolder -Force -Recurse }

Write-Output "Version:$version"

dotnet build QQWrySln.sln --configuration Release
function CheckProcess ([string]$action) {
if (-Not $?) {
Write-Host ("$action failed")
Set-Location $rootFolder
exit $LASTEXITCODE
}
}

#build
dotnet build $solutionPath --configuration Release

CheckProcess "build"

#test
dotnet test $solutionPath --configuration Release --no-restore

dotnet test QQWrySln.sln --configuration Release
CheckProcess "test"

dotnet pack .\QQWry -o $outputFolder -p:Version=$version --configuration Release
#pack
dotnet pack .\QQWry -o $outputFolder -p:Version=$version --configuration Release --no-restore

dotnet pack .\QQWry.DependencyInjection -o $outputFolder -p:Version=$version --configuration Release
CheckProcess "pack QQWry"

dotnet pack .\QQWry.DependencyInjection -o $outputFolder -p:Version=$version --configuration Release --no-restore

CheckProcess "pack QQWry.DependencyInjection"

#nuget push
if ($nugetKey) {
dotnet nuget push "$outputFolder\*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $nugetKey

CheckProcess "nuget push"
}
else {
Write-Output "Skip nuget push"
Expand Down

0 comments on commit 000cb41

Please sign in to comment.