Skip to content

Commit c8d3c6b

Browse files
committed
- Fix git version
1 parent 563d3a7 commit c8d3c6b

File tree

1 file changed

+43
-32
lines changed

1 file changed

+43
-32
lines changed

.github/workflows/PR-CI.yml

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@ on:
33
pull_request:
44
types: [opened, reopened, edited, synchronize]
55
paths-ignore:
6-
- "**/*.md"
76
- "**/*.gitignore"
87
- "**/*.gitattributes"
8+
branches:
9+
- master
10+
- develop/**
11+
- pre-release/**
12+
- release/**
913
jobs:
1014
Run-Lint:
1115
runs-on: ubuntu-latest
1216
env:
1317
github-token: '${{ secrets.GH_Packages }}'
1418
steps:
1519
- name: Step-01 Checkout code
16-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
1721
with:
1822
fetch-depth: 0
1923
- name: Step-02 Lint Code Base
@@ -26,96 +30,103 @@ jobs:
2630
Build-Test:
2731
runs-on: ubuntu-latest
2832
outputs:
29-
release_Version: ${{ steps.gitversion.outputs.MajorMinorPatch }}
30-
beta_Version: ${{ steps.gitversion.outputs.nuGetVersion }}
31-
branchName: ${{ steps.gitversion.outputs.branchName }}
33+
nuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}
34+
majorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}
35+
fullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}
36+
branchName: ${{ steps.gitversion.outputs.BranchName }}
3237
env:
33-
working-directory: /home/runner/work/sourceflow.net/sourceflow.net
38+
working-directory: ${{ github.workspace }}
3439

3540
steps:
3641
- name: Step-01 Install GitVersion
37-
uses: gittools/actions/gitversion/[email protected].7
42+
uses: gittools/actions/gitversion/[email protected].15
3843
with:
3944
versionSpec: 5.x
4045

4146
- name: Step-02 Check out Code
4247
uses: actions/checkout@v4
4348
with:
4449
fetch-depth: 0
50+
ref: ${{ github.event.pull_request.head.sha }}
4551

4652
- name: Step-03 Calculate Version
4753
id: gitversion
48-
uses: gittools/actions/gitversion/[email protected].7
54+
uses: gittools/actions/gitversion/[email protected].15
4955
with:
5056
useConfigFile: true
5157

52-
- name: Step-04 Install .NET
58+
- name: Step-04 Display Version Info
59+
run: |
60+
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
61+
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
62+
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
63+
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
64+
65+
- name: Step-05 Install .NET
5366
uses: actions/setup-dotnet@v3
5467
with:
5568
dotnet-version: 9.0.x
5669

57-
- name: Step-05 Restore dependencies
70+
- name: Step-06 Restore dependencies
5871
run: dotnet restore
5972
working-directory: '${{ env.working-directory }}'
6073

61-
- name: Step-06 Build Version (Beta)
62-
if: ${{ !startsWith(github.head_ref, 'release/')}}
63-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }}
74+
- name: Step-07 Build Version (Beta)
75+
if: ${{ !startsWith(github.head_ref, 'release/') }}
76+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
6477
working-directory: '${{ env.working-directory }}'
6578

66-
- name: Step-06 Build Version (Release)
67-
if: ${{ startsWith(github.head_ref, 'release/')}}
68-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
79+
- name: Step-07 Build Version (Release)
80+
if: ${{ startsWith(github.head_ref, 'release/') }}
81+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
6982
working-directory: '${{ env.working-directory }}'
7083

71-
- name: Step-07 Test Solution
72-
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
84+
- name: Step-08 Test Solution
85+
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
7386
working-directory: '${{ env.working-directory }}'
7487

75-
- name: Step-08 Upload Build Artifacts
88+
- name: Step-09 Upload Build Artifacts
7689
uses: actions/upload-artifact@v4
7790
with:
7891
name: build-artifact
79-
path: ${{env.working-directory}}
92+
path: ${{ env.working-directory }}
8093
retention-days: 1
8194

8295
Package:
8396
needs: [Build-Test]
8497
runs-on: ubuntu-latest
85-
outputs:
86-
semVersion: ${{ needs.Build-Release.outputs.semVersion }}
8798
env:
8899
github-token: '${{ secrets.GH_Packages }}'
89100
nuget-token: '${{ secrets.NUGET_API_KEY }}'
90-
working-directory: /home/runner/work/sourceflow.net/sourceflow.net
101+
working-directory: ${{ github.workspace }}
91102
steps:
92103
- name: Step-01 Retrieve Build Artifacts
93104
uses: actions/download-artifact@v4
94105
with:
95106
name: build-artifact
96-
path: ${{env.working-directory}}
107+
path: ${{ env.working-directory }}
97108

98109
- name: Step-02 Install Github Packages
99110
run: dotnet tool install gpr --global
100111

101112
- name: Step-03 Publish to Github Packages
102-
run: find -name "*.nupkg" -print -exec gpr push -k ${{env.github-token}} {} \;
113+
run: find . -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
103114

104115
Release:
105116
name: Release to Nuget
106117
needs: [Package]
107-
if: ${{ startsWith(github.head_ref, 'release/')}}
118+
if: ${{ startsWith(github.head_ref, 'release/') }}
108119
runs-on: ubuntu-latest
109120
env:
110121
nuget-token: '${{ secrets.NUGET_API_KEY }}'
111-
working-directory: /home/runner/work/sourceflow.net/sourceflow.net
122+
working-directory: ${{ github.workspace }}
112123
steps:
113124
- name: Step-01 Retrieve Build Artifacts
114125
uses: actions/download-artifact@v4
115126
with:
116127
name: build-artifact
117-
path: ${{env.working-directory}}
118-
- name: Step-03 Release to Nuget Org
119-
if: ${{ startsWith(github.head_ref, 'release/')}}
120-
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
121-
128+
path: ${{ env.working-directory }}
129+
130+
- name: Step-02 Release to Nuget Org
131+
run: |
132+
find ${{ env.working-directory }}/src -name "*.nupkg" -path "*/Release/*.nupkg" -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;

0 commit comments

Comments
 (0)