-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 4.04 KB
/
PR-CI.yml
File metadata and controls
121 lines (107 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: pr-ci
on:
pull_request:
types: [opened, reopened, edited, synchronize]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
jobs:
Run-Lint:
runs-on: ubuntu-latest
env:
github-token: '${{ secrets.GH_Packages }}'
steps:
- name: Step-01 Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Step-02 Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_INCLUDE: .*src/.*
DEFAULT_BRANCH: master
GITHUB_TOKEN: '${{ env.github-token }}'
Build-Test:
runs-on: ubuntu-latest
outputs:
release_Version: ${{ steps.gitversion.outputs.MajorMinorPatch }}
beta_Version: ${{ steps.gitversion.outputs.nuGetVersion }}
branchName: ${{ steps.gitversion.outputs.branchName }}
env:
working-directory: /home/runner/work/JSONPredicate/JSONPredicate
steps:
- name: Step-01 Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: 5.x
- name: Step-02 Check out Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Step-03 Calculate Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
- name: Step-04 Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Step-05 Restore dependencies
run: dotnet restore
working-directory: '${{ env.working-directory }}'
- name: Step-06 Build Version (Beta)
if: ${{ !startsWith(github.head_ref, 'release/')}}
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }}
working-directory: '${{ env.working-directory }}'
- name: Step-06 Build Version (Release)
if: ${{ startsWith(github.head_ref, 'release/')}}
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
working-directory: '${{ env.working-directory }}'
- name: Step-07 Test Solution
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
working-directory: '${{ env.working-directory }}'
- name: Step-08 Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: ${{env.working-directory}}
retention-days: 1
Package:
needs: [Build-Test]
runs-on: ubuntu-latest
outputs:
semVersion: ${{ needs.Build-Release.outputs.semVersion }}
env:
github-token: '${{ secrets.GH_Packages }}'
nuget-token: '${{ secrets.NUGET_API_KEY }}'
working-directory: /home/runner/work/JSONPredicate/JSONPredicate
steps:
- name: Step-01 Retrieve Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifact
path: ${{env.working-directory}}
- name: Step-02 Install Github Packages
run: dotnet tool install gpr --global
- name: Step-03 Publish to Github Packages
run: find -name "*.nupkg" -print -exec gpr push -k ${{env.github-token}} {} \;
Release:
name: Release to Nuget
needs: [Package]
if: ${{ startsWith(github.head_ref, 'release/')}}
runs-on: ubuntu-latest
env:
nuget-token: '${{ secrets.NUGET_API_KEY }}'
working-directory: /home/runner/work/JSONPredicate/JSONPredicate
steps:
- name: Step-01 Retrieve Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifact
path: ${{env.working-directory}}
- name: Step-03 Release to Nuget Org
if: ${{ startsWith(github.head_ref, 'release/')}}
run: dotnet nuget push ${{env.working-directory}}/src/parsley/bin/Release/*.nupkg --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json