Skip to content

Commit 202927a

Browse files
committed
Added github workflow
1 parent 360a045 commit 202927a

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: .NET Core
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
pull_request:
7+
release:
8+
types:
9+
- published
10+
env:
11+
# Stop wasting time caching packages
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
13+
# Disable sending usage data to Microsoft
14+
DOTNET_CLI_TELEMETRY_OPTOUT: true
15+
# Project name to pack and publish
16+
PROJECT_NAME: Synercoding.FileFormats.Pdf
17+
# GitHub Packages Feed settings
18+
GITHUB_FEED: https://nuget.pkg.github.com/synercoder/index.json
19+
GITHUB_USER: synercoder
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
# Official NuGet Feed settings
22+
NUGET_FEED: https://api.nuget.org/v3/index.json
23+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
24+
jobs:
25+
build:
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
os: [ ubuntu-latest, windows-latest, macos-latest ]
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
- name: Setup .NET Core
34+
uses: actions/setup-dotnet@v1
35+
with:
36+
dotnet-version: 3.1.x
37+
- name: Restore
38+
run: dotnet restore
39+
- name: Build
40+
run: dotnet build -c Release --no-restore
41+
- name: Test
42+
run: dotnet test -c Release
43+
- name: Pack
44+
if: matrix.os == 'ubuntu-latest'
45+
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:SymbolPackageFormat=snupkg -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.*proj
46+
- name: Upload Artifact
47+
if: matrix.os == 'ubuntu-latest'
48+
uses: actions/upload-artifact@v2
49+
with:
50+
name: nupkg
51+
path: ./artifacts/pkg/Release/${{ env.PROJECT_NAME }}.*.nupkg
52+
prerelease:
53+
needs: build
54+
if: github.ref == 'refs/heads/develop'
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Download Artifact
58+
uses: actions/download-artifact@v1
59+
with:
60+
name: nupkg
61+
- name: Push to GitHub Feed
62+
run: |
63+
for f in ./nupkg/*.nupkg
64+
do
65+
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
66+
done
67+
deploy:
68+
needs: build
69+
if: github.event_name == 'release'
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v2
73+
- name: Setup .NET Core
74+
uses: actions/setup-dotnet@v1
75+
with:
76+
dotnet-version: 3.1.x
77+
- name: Create Release NuGet package
78+
run: |
79+
arrTag=(${GITHUB_REF//\// })
80+
VERSION="${arrTag[2]}"
81+
echo Version: $VERSION
82+
VERSION="${VERSION//v}"
83+
echo Clean Version: $VERSION
84+
dotnet pack -v normal -c Release --include-symbols --include-source -p:SymbolPackageFormat=snupkg -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
85+
- name: Push to GitHub Feed
86+
run: |
87+
for f in ./nupkg/*.nupkg
88+
do
89+
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
90+
done
91+
- name: Push to NuGet Feed
92+
if: ${{ env.NUGET_FEED }} != ''
93+
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY

Synercoding.FileFormats.Pdf.sln

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{6AAE343B-2
3131
README.md = README.md
3232
EndProjectSection
3333
EndProject
34+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{67FFC819-02FC-4D51-8D02-4588713DE0AB}"
35+
EndProject
36+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B1B3DE7C-7961-4FA6-BABD-06B3979D1ABF}"
37+
ProjectSection(SolutionItems) = preProject
38+
.github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
39+
EndProjectSection
40+
EndProject
3441
Global
3542
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3643
Debug|Any CPU = Debug|Any CPU
@@ -55,6 +62,8 @@ Global
5562
{4FA81463-B64F-40F2-A3F1-226179796E09} = {6AAE343B-2D3D-4F7F-BC6D-6481428BECB2}
5663
{E11AEF6A-6977-4D76-83E2-D5BDB84F3872} = {76970674-A4D1-4439-8EA6-8832E4A24FF1}
5764
{90A3DC19-7312-4649-8B1E-9455D664C074} = {BE969D07-4BE6-4293-BBC6-C496F7D4A81C}
65+
{67FFC819-02FC-4D51-8D02-4588713DE0AB} = {6AAE343B-2D3D-4F7F-BC6D-6481428BECB2}
66+
{B1B3DE7C-7961-4FA6-BABD-06B3979D1ABF} = {67FFC819-02FC-4D51-8D02-4588713DE0AB}
5867
EndGlobalSection
5968
GlobalSection(ExtensibilityGlobals) = postSolution
6069
SolutionGuid = {8DB7E905-EFFC-44B7-A5B5-3CC08E3F5AD9}

0 commit comments

Comments
 (0)