Skip to content

Commit 22d6382

Browse files
committed
Initial commit
0 parents  commit 22d6382

File tree

81 files changed

+4889
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4889
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
# Don't trigger CI for a tag, the commit will trigger it already.
8+
tags-ignore:
9+
- '*.*'
10+
11+
env:
12+
# Disable sending usage data to Microsoft
13+
DOTNET_CLI_TELEMETRY_OPTOUT: true
14+
15+
DOTNETVERSION: "6.0.x"
16+
17+
jobs:
18+
Build_and_Test:
19+
name: Continuous Integration
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout source
23+
uses: actions/checkout@v2
24+
25+
- name: Setup NuGet Cache
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.nuget/packages
29+
key: ${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
30+
31+
- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
32+
uses: actions/setup-dotnet@v1
33+
with:
34+
dotnet-version: ${{ env.DOTNETVERSION }}
35+
36+
# Those projects are only needed at development time and NET48 can't build on Linux.
37+
- name: Remove development project from solution
38+
run: dotnet sln PDFinch.Client.sln remove TestClients/PDFinch.TestClient.NET48 TestClients/PDFinch.TestClient.NET50 TestClients/PDFinch.TestClient.Shared
39+
40+
- name: Restore
41+
run: dotnet restore
42+
43+
- name: Build
44+
run: dotnet build --configuration Release --no-restore
45+
46+
- name: Test
47+
run: dotnet test -c Release --no-restore --no-build
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Delete Old Workflow Runs
2+
3+
on:
4+
schedule:
5+
# Run every 20th of the month at 08:00
6+
- cron: '0 8 20 * *'
7+
workflow_dispatch:
8+
inputs:
9+
retain_days:
10+
description: 'Days of workflow runs to keep'
11+
required: true
12+
default: '180'
13+
retain_runs:
14+
description: 'Minimum number of workflow runs to keep'
15+
required: true
16+
default: '10'
17+
18+
jobs:
19+
delete_old_workflow_runs:
20+
name: Delete Old Workflow Runs
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Set environment variables
24+
env:
25+
DEFAULT_RETAIN_DAYS: '180'
26+
DEFAULT_RETAIN_RUNS: '10'
27+
run: |
28+
echo "RETAIN_DAYS=${{ github.event.inputs.retain_days || env.DEFAULT_RETAIN_DAYS }}" >> $GITHUB_ENV
29+
echo "RETAIN_RUNS=${{ github.event.inputs.retain_runs || env.DEFAULT_RETAIN_RUNS }}" >> $GITHUB_ENV
30+
- name: Delete workflow runs older than ${{ env.RETAIN_DAYS }} days, keeping ${{ env.RETAIN_RUNS }} runs
31+
uses: Mattraks/[email protected]
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
repository: ${{ github.repository }}
35+
retain_days: ${{ env.RETAIN_DAYS }}
36+
keep_minimum_runs: ${{ env.RETAIN_RUNS }}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release Applications
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
# Disable sending usage data to Microsoft
10+
DOTNET_CLI_TELEMETRY_OPTOUT: true
11+
12+
DOTNETVERSION: "6.0.x"
13+
14+
PACK_OUTPUT_DIR: "NuGetPackageStagingArea"
15+
16+
jobs:
17+
Build_and_Publish:
18+
name: Build, Test, Publish NuGet Packages
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout source
22+
uses: actions/checkout@v2
23+
24+
- name: Setup NuGet Cache
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.nuget/packages
28+
key: ${{ runner.os }}-nuget-v0-${{ hashFiles('**/*.csproj') }}
29+
30+
- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
31+
uses: actions/setup-dotnet@v1
32+
with:
33+
dotnet-version: ${{ env.DOTNETVERSION }}
34+
35+
# Those projects are only needed at development time and NET48 can't build on Linux.
36+
- name: Remove development project from solution
37+
run: dotnet sln PDFinch.Client.sln remove TestClients/PDFinch.TestClient.NET48 TestClients/PDFinch.TestClient.NET50 TestClients/PDFinch.TestClient.Shared
38+
39+
# Versioning: semver
40+
- name: Get version
41+
id: battila7Version
42+
uses: battila7/[email protected]
43+
44+
- name: Get SHA
45+
uses: benjlevesque/[email protected]
46+
id: benShortSha
47+
with:
48+
length: 7
49+
50+
# Package version: "v0.7.0-beta07", "v1.0.0" and so on.
51+
- name: Set Package Version
52+
run: echo "PACKAGE_VERSION=${{ steps.battila7Version.outputs.version-without-v }}" >> $GITHUB_ENV
53+
54+
# Assembly version: "v1.0.2-alpha03+4acdfc0" or "v1.0.2+abc1234".
55+
- name: Set Assembly Version
56+
run: echo "ASSEMBLY_VERSION=${{ env.PACKAGE_VERSION }}+${{ steps.benShortSha.outputs.sha }}" >> $GITHUB_ENV
57+
58+
# Restore, build, test...
59+
- name: Restore dependencies
60+
run: dotnet restore
61+
62+
- name: Build Release
63+
run: dotnet build --configuration Release --no-restore -p:Version=$ASSEMBLY_VERSION
64+
65+
- name: Run Unit Tests
66+
run: dotnet test --configuration Release --no-build --verbosity normal
67+
68+
# Pack the build output
69+
- name: Pack NuGet packages
70+
uses: EasyDesk/action-dotnet-pack@v1
71+
with:
72+
project-names: |
73+
src/PDFinch.Client.Common
74+
src/PDFinch.Client
75+
src/PDFinch.Client.Extensions
76+
package-version: ${{ env.PACKAGE_VERSION }}
77+
output-dir: ${{ env.PACK_OUTPUT_DIR }}
78+
skip-build: true
79+
80+
# Create release, attach package files
81+
- name: Release
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
name: ${{ env.ASSEMBLY_VERSION }}
85+
generate_release_notes: true
86+
prerelease: ${{ steps.battila7Version.outputs.is-prerelease }}
87+
files: ${{ env.PACK_OUTPUT_DIR }}/*.*nupkg
88+
89+
# Release to NuGet!
90+
- name: Release to NuGet.org
91+
run: dotnet nuget push ${{ env.PACK_OUTPUT_DIR }}/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)