Skip to content

Commit 3a60836

Browse files
authored
Dev2Main (#26)
1 parent e49a5b8 commit 3a60836

File tree

5 files changed

+87
-7
lines changed

5 files changed

+87
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
- uses: actions/setup-dotnet@v4
1818
with:
1919
global-json-file: './global.json'
20-
- run: dotnet --version
21-
- name: Build
22-
run: dotnet build
23-
- name: Test
24-
run: dotnet test --no-build
20+
- name: Build and Test
21+
run: ./scripts/Build.ps1
22+
shell: pwsh

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'RELEASE'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*.*.*'
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-dotnet@v4
17+
with:
18+
global-json-file: './global.json'
19+
- name: Build and Test
20+
run: ./scripts/Build.ps1
21+
shell: pwsh
22+
- name: Push to NuGet
23+
env:
24+
NUGET_URL: https://api.nuget.org/v3/index.json
25+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
26+
run: ./Push.ps1
27+
shell: pwsh
28+
- name: Artifacts
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: artifacts
32+
path: artifacts/**/*

scripts/Build.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Taken from psake https://github.com/psake/psake
2+
3+
<#
4+
.SYNOPSIS
5+
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
6+
to see if an error occcured. If an error is detected then an exception is thrown.
7+
This function allows you to run command-line programs without having to
8+
explicitly check the $lastexitcode variable.
9+
.EXAMPLE
10+
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
11+
#>
12+
function Exec
13+
{
14+
[CmdletBinding()]
15+
param(
16+
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
17+
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
18+
)
19+
& $cmd
20+
if ($lastexitcode -ne 0) {
21+
throw ("Exec: " + $errorMessage)
22+
}
23+
}
24+
25+
$artifacts = ".\artifacts"
26+
27+
if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }
28+
29+
exec { & dotnet clean -c Release }
30+
31+
exec { & dotnet build -c Release }
32+
33+
exec { & dotnet test -c Release --no-build -l trx --verbosity=normal }
34+
35+
exec { & dotnet pack .\src\Axepta.SDK\Axepta.SDK.csproj -c Release -o $artifacts --no-build }

scripts/Push.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$scriptName = $MyInvocation.MyCommand.Name
2+
$artifacts = "./artifacts"
3+
4+
if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
5+
Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
6+
} else {
7+
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
8+
Write-Host "$($scriptName): Pushing $($_.Name)"
9+
dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
10+
if ($lastexitcode -ne 0) {
11+
throw ("Exec: " + $errorMessage)
12+
}
13+
}
14+
}

src/Axepta.SDK/Axepta.SDK.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<PackageId>Axepta.SDK</PackageId>
8-
<VersionPrefix>1.0.5</VersionPrefix>
98
<Authors>Maksymilian Szokalski</Authors>
9+
<Copyright>Copyright Maksymilian Szokalski</Copyright>
1010
<Description>Axepta.SDK is a class library for BNP Paribas Axepta Paywall</Description>
11-
<PackageTags>BNP Paribas;Axepta;Paywall;Payments;Transactions</PackageTags>
11+
<PackageTags>bnp paribas;axepta;paywall;payments;transactions</PackageTags>
12+
<MinVerTagPrefix>v</MinVerTagPrefix>
1213
<RepositoryUrl>https://github.com/illunix/Axepta.SDK</RepositoryUrl>
1314
<PackageProjectUrl>https://github.com/illunix/Axepta.SDK</PackageProjectUrl>
1415
<PackageIcon>AxeptaLogo.png</PackageIcon>

0 commit comments

Comments
 (0)