Skip to content

Commit fef9d8b

Browse files
authored
Merge pull request #82 from AutoMapper/GithubActions
GitHub actions
2 parents 170294c + 8725934 commit fef9d8b

File tree

7 files changed

+93
-87
lines changed

7 files changed

+93
-87
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set Variables
18+
run: |
19+
echo '::set-env name=VERSION_NUMBER::4.0.1-preview-1'
20+
echo '::set-env name=DEPLOY_PACKAGE_URL::https://www.myget.org/F/automapperdev/api/v3/index.json'
21+
echo '::set-env name=DEPLOY_PACKAGE_API_KEY::${{ secrets.MYGET_CI_API_KEY }}'
22+
echo '::set-env name=REPO::${{ github.repository }}'
23+
echo '::set-env name=REPO_OWNER::${{ github.repository_owner }}'
24+
25+
- name: Restore
26+
run: dotnet restore
27+
28+
- name: Build
29+
run: dotnet build --configuration Release --no-restore
30+
31+
- name: Test
32+
run: dotnet test --no-restore --verbosity normal
33+
34+
- run: echo '::set-env name=PROJECT_NAME::AutoMapper.Extensions.ExpressionMapping'
35+
- name: Pack and push
36+
run: ./Pack_Push.ps1
37+
shell: pwsh

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: windows-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set Variables
16+
run: |
17+
echo '::set-env name=VERSION_NUMBER::4.0.1-preview-1'
18+
echo '::set-env name=DEPLOY_PACKAGE_URL::https://api.nuget.org/v3/index.json'
19+
echo '::set-env name=DEPLOY_PACKAGE_API_KEY::${{ secrets.NUGET_API_KEY }}'
20+
echo '::set-env name=REPO::${{ github.repository }}'
21+
echo '::set-env name=REPO_OWNER::${{ github.repository_owner }}'
22+
23+
- name: Restore
24+
run: dotnet restore
25+
26+
- name: Build
27+
run: dotnet build --configuration Release --no-restore
28+
29+
- name: Test
30+
run: dotnet test --no-restore --verbosity normal
31+
32+
- run: echo '::set-env name=PROJECT_NAME::AutoMapper.Extensions.ExpressionMapping'
33+
- name: Pack and push
34+
run: ./Pack_Push.ps1
35+
shell: pwsh

AutoMapper.Extensions.ExpressionMapping.sln

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
.gitattributes = .gitattributes
1313
.gitignore = .gitignore
14-
appveyor.yml = appveyor.yml
15-
Build.ps1 = Build.ps1
14+
.github\workflows\ci.yml = .github\workflows\ci.yml
1615
Directory.Build.props = Directory.Build.props
1716
LICENSE = LICENSE
17+
Pack_Push.ps1 = Pack_Push.ps1
1818
README.md = README.md
19+
.github\workflows\release.yml = .github\workflows\release.yml
1920
EndProjectSection
2021
EndProject
2122
Global

Build.ps1

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

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<Authors>Jimmy Bogard</Authors>
44
<LangVersion>latest</LangVersion>
5-
<VersionPrefix>4.0.0</VersionPrefix>
5+
<VersionPrefix>4.0.1-preview-1</VersionPrefix>
66
<WarningsAsErrors>true</WarningsAsErrors>
77
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
88
</PropertyGroup>

Pack_Push.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$scriptName = $MyInvocation.MyCommand.Name
2+
3+
Write-Host "Owner ${Env:REPO_OWNER}"
4+
Write-Host "Repository ${Env:REPO}"
5+
6+
$PROJECT_PATH = ".\src\$($Env:PROJECT_NAME)\$($Env:PROJECT_NAME).csproj"
7+
$NUGET_PACKAGE_PATH = ".\artifacts\$($Env:PROJECT_NAME).$($Env:VERSION_NUMBER).nupkg"
8+
9+
Write-Host "Project Path ${PROJECT_PATH}"
10+
Write-Host "Package Path ${NUGET_PACKAGE_PATH}"
11+
12+
if ($Env:REPO_OWNER -ne "AutoMapper") {
13+
Write-Host "${scriptName}: Only creates packages on AutoMapper repositories."
14+
} else {
15+
dotnet pack $PROJECT_PATH -c Release -o .\artifacts --no-build
16+
dotnet nuget push $NUGET_PACKAGE_PATH --skip-duplicate --source $Env:DEPLOY_PACKAGE_URL --api-key $Env:DEPLOY_PACKAGE_API_KEY
17+
}

appveyor.yml

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

0 commit comments

Comments
 (0)