Skip to content

Commit 1ef3291

Browse files
Piertalbargaoanu
andauthored
Moved from appveyor to GH actions flow (#62)
* Moved from appveyor to GH actions flow * Update Build.ps1 Co-authored-by: Lucian Bargaoanu <lbargaoanu@users.noreply.github.com>
1 parent 4c71bca commit 1ef3291

7 files changed

Lines changed: 92 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
runs-on: windows-2022
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Build and Test
21+
run: ./Build.ps1
22+
shell: pwsh
23+
- name: Push to MyGet
24+
env:
25+
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
26+
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
27+
run: ./Push.ps1
28+
shell: pwsh
29+
- name: Artifacts
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: artifacts
33+
path: artifacts/**/*

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
runs-on: windows-2022
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Build and Test
18+
run: ./Build.ps1
19+
shell: pwsh
20+
- name: Push to MyGet
21+
env:
22+
NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
23+
NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
24+
run: ./Push.ps1
25+
shell: pwsh
26+
- name: Push to NuGet
27+
env:
28+
NUGET_URL: https://api.nuget.org/v3/index.json
29+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
30+
run: ./Push.ps1
31+
shell: pwsh
32+
- name: Artifacts
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: artifacts
36+
path: artifacts/**/*

AutoMapper.Data.sln

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
.gitattributes = .gitattributes
1313
.gitignore = .gitignore
14-
appveyor.yml = appveyor.yml
1514
Build.ps1 = Build.ps1
15+
.github\workflows\ci.yml = .github\workflows\ci.yml
16+
Push.ps1 = Push.ps1
1617
README.md = README.md
18+
.github\workflows\release.yml = .github\workflows\release.yml
1719
EndProjectSection
1820
EndProject
1921
Global

Build.ps1

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,13 @@ function Exec
2222
}
2323
}
2424

25+
$artifacts = ".\artifacts"
2526
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
2627

28+
exec { & dotnet clean -c Release }
2729
exec { & dotnet restore }
2830

29-
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
30-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
31-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
32-
$commitHash = $(git rev-parse --short HEAD)
33-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
34-
$versionSuffix = @{ $true = "--version-suffix=$($suffix)"; $false = ""}[$suffix -ne ""]
35-
36-
exec { & dotnet build AutoMapper.Data.sln -c Release --version-suffix=$buildSuffix -v q /nologo }
37-
38-
exec { & dotnet test -c Release --no-build }
39-
40-
exec { & dotnet pack .\AutoMapper.Data -c Release -o artifacts --include-symbols --no-build $versionSuffix }
41-
31+
exec { & dotnet build AutoMapper.Data.sln -c Release -v q /nologo }
32+
exec { & dotnet test -c Release -r $artifacts --no-build -l trx --verbosity=normal }
4233

34+
exec { & dotnet pack .\AutoMapper.Data -c Release -o artifacts --include-symbols --no-build }

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+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#### The data extensions to AutoMapper, IDataReader support
55

6+
[![CI](https://github.com/automapper/automapper.data/workflows/CI/badge.svg)](https://github.com/AutoMapper/AutoMapper.Data/actions?query=workflow%3ACI)
67
[![NuGet](http://img.shields.io/nuget/v/AutoMapper.Data.svg?label=NuGet)](https://www.nuget.org/packages/AutoMapper.Data/)
78
[![MyGet (dev)](https://img.shields.io/myget/automapperdev/vpre/AutoMapper.Data.svg?label=MyGet)](https://myget.org/feed/automapperdev/package/nuget/AutoMapper.Data)
89

appveyor.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)