Skip to content

Commit f530c8d

Browse files
committed
- Fix Github Actions
1 parent a7a0b43 commit f530c8d

File tree

4 files changed

+147
-65
lines changed

4 files changed

+147
-65
lines changed

.github/workflows/PR-CI.yml

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,9 @@ on:
33
pull_request:
44
types: [opened, reopened, edited, synchronize]
55
paths-ignore:
6+
- "**/*.md"
67
- "**/*.gitignore"
78
- "**/*.gitattributes"
8-
branches:
9-
- master
10-
- develop/**
11-
- pre-release/**
12-
- release/**
13-
push:
14-
branches:
15-
- pre-release/**
16-
- pre-release
17-
- release/**
18-
- release
199

2010
jobs:
2111
Run-Lint:
@@ -55,7 +45,7 @@ jobs:
5545
uses: actions/checkout@v4
5646
with:
5747
fetch-depth: 0
58-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
48+
ref: ${{ github.event.pull_request.head.sha }}
5949

6050
- name: Step-03 Calculate Version
6151
id: gitversion
@@ -68,7 +58,6 @@ jobs:
6858
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
6959
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
7060
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
71-
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
7261
7362
- name: Step-05 Install .NET
7463
uses: actions/setup-dotnet@v3
@@ -79,18 +68,7 @@ jobs:
7968
run: dotnet restore
8069
working-directory: '${{ env.working-directory }}'
8170

82-
- name: Step-07 Build Version (Pre-release Alpha)
83-
if: ${{ startsWith(github.head_ref, 'pre-release/') || startsWith(github.ref, 'refs/heads/pre-release/') }}
84-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
85-
working-directory: '${{ env.working-directory }}'
86-
87-
- name: Step-07 Build Version (Release)
88-
if: ${{ startsWith(github.head_ref, 'release/') || startsWith(github.ref, 'refs/heads/release/') }}
89-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
90-
working-directory: '${{ env.working-directory }}'
91-
92-
- name: Step-07 Build Version (Beta/Other)
93-
if: ${{ !(startsWith(github.head_ref, 'pre-release/') || startsWith(github.ref, 'refs/heads/pre-release/') || startsWith(github.head_ref, 'release/') || startsWith(github.ref, 'refs/heads/release/')) }}
71+
- name: Step-07 Build Version (Beta)
9472
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
9573
working-directory: '${{ env.working-directory }}'
9674

@@ -103,43 +81,4 @@ jobs:
10381
with:
10482
name: build-artifact
10583
path: ${{ env.working-directory }}
106-
retention-days: 1
107-
108-
Package:
109-
needs: [Build-Test]
110-
runs-on: ubuntu-latest
111-
env:
112-
github-token: '${{ secrets.GH_Packages }}'
113-
nuget-token: '${{ secrets.NUGET_API_KEY }}'
114-
working-directory: ${{ github.workspace }}
115-
steps:
116-
- name: Step-01 Retrieve Build Artifacts
117-
uses: actions/download-artifact@v4
118-
with:
119-
name: build-artifact
120-
path: ${{ env.working-directory }}
121-
122-
- name: Step-02 Install Github Packages
123-
run: dotnet tool install gpr --global
124-
125-
- name: Step-03 Publish to Github Packages
126-
run: find . -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
127-
128-
Release:
129-
name: Release to Nuget
130-
needs: [Package]
131-
if: ${{ startsWith(github.head_ref, 'release/') || startsWith(github.ref, 'refs/heads/release/') }}
132-
runs-on: ubuntu-latest
133-
env:
134-
nuget-token: '${{ secrets.NUGET_API_KEY }}'
135-
working-directory: ${{ github.workspace }}
136-
steps:
137-
- name: Step-01 Retrieve Build Artifacts
138-
uses: actions/download-artifact@v4
139-
with:
140-
name: build-artifact
141-
path: ${{ env.working-directory }}
142-
143-
- name: Step-02 Release to Nuget Org
144-
run: |
145-
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 \;
84+
retention-days: 1
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: pre-release-ci
2+
on:
3+
push:
4+
branches:
5+
- pre-release/**
6+
- pre-release
7+
8+
jobs:
9+
Build-Test-Publish:
10+
runs-on: ubuntu-latest
11+
env:
12+
working-directory: ${{ github.workspace }}
13+
github-token: '${{ secrets.GH_Packages }}'
14+
nuget-token: '${{ secrets.NUGET_API_KEY }}'
15+
16+
steps:
17+
- name: Step-01 Install GitVersion
18+
uses: gittools/actions/gitversion/[email protected]
19+
with:
20+
versionSpec: 5.x
21+
22+
- name: Step-02 Check out Code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Step-03 Calculate Version
28+
id: gitversion
29+
uses: gittools/actions/gitversion/[email protected]
30+
with:
31+
useConfigFile: true
32+
33+
- name: Step-04 Display Version Info
34+
run: |
35+
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
36+
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
37+
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
38+
39+
- name: Step-05 Install .NET
40+
uses: actions/setup-dotnet@v3
41+
with:
42+
dotnet-version: 9.0.x
43+
44+
- name: Step-06 Restore dependencies
45+
run: dotnet restore
46+
working-directory: '${{ env.working-directory }}'
47+
48+
- name: Step-07 Build Version (Alpha)
49+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
50+
working-directory: '${{ env.working-directory }}'
51+
52+
- name: Step-08 Test Solution
53+
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
54+
working-directory: '${{ env.working-directory }}'
55+
56+
- name: Step-09 Create NuGet Package
57+
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
58+
working-directory: '${{ env.working-directory }}'
59+
60+
- name: Step-10 Publish to Github Packages
61+
run: |
62+
dotnet tool install gpr --global
63+
find ./packages -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
64+
working-directory: '${{ env.working-directory }}'
65+
66+
- name: Step-11 Publish to NuGet.org (for release pre-releases)
67+
if: ${{ env.nuget-token != '' && contains(github.ref, 'pre-release/v') }}
68+
run: |
69+
find ./packages -name "*.nupkg" -print -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;
70+
working-directory: '${{ env.working-directory }}'

.github/workflows/Release-CI.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: release-ci
2+
on:
3+
push:
4+
branches:
5+
- release/**
6+
- release
7+
8+
jobs:
9+
Build-Test-Publish:
10+
runs-on: ubuntu-latest
11+
env:
12+
working-directory: ${{ github.workspace }}
13+
github-token: '${{ secrets.GH_Packages }}'
14+
nuget-token: '${{ secrets.NUGET_API_KEY }}'
15+
16+
steps:
17+
- name: Step-01 Install GitVersion
18+
uses: gittools/actions/gitversion/[email protected]
19+
with:
20+
versionSpec: 5.x
21+
22+
- name: Step-02 Check out Code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Step-03 Calculate Version
28+
id: gitversion
29+
uses: gittools/actions/gitversion/[email protected]
30+
with:
31+
useConfigFile: true
32+
33+
- name: Step-04 Display Version Info
34+
run: |
35+
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
36+
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
37+
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
38+
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
39+
40+
- name: Step-05 Install .NET
41+
uses: actions/setup-dotnet@v3
42+
with:
43+
dotnet-version: 9.0.x
44+
45+
- name: Step-06 Restore dependencies
46+
run: dotnet restore
47+
working-directory: '${{ env.working-directory }}'
48+
49+
- name: Step-07 Build Version (Stable)
50+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
51+
working-directory: '${{ env.working-directory }}'
52+
53+
- name: Step-08 Test Solution
54+
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
55+
working-directory: '${{ env.working-directory }}'
56+
57+
- name: Step-09 Create NuGet Package
58+
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
59+
working-directory: '${{ env.working-directory }}'
60+
61+
- name: Step-10 Publish to Github Packages
62+
run: |
63+
dotnet tool install gpr --global
64+
find ./packages -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
65+
working-directory: '${{ env.working-directory }}'
66+
67+
- name: Step-11 Publish to NuGet.org
68+
if: ${{ env.nuget-token != '' }}
69+
run: |
70+
find ./packages -name "*.nupkg" -print -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;
71+
working-directory: '${{ env.working-directory }}'

SourceFlow.Net.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{F81A2C
2727
.github\workflows\Master-CodeQL.yml = .github\workflows\Master-CodeQL.yml
2828
.github\workflows\PR-CI.yml = .github\workflows\PR-CI.yml
2929
.github\workflows\PR-CodeQL.yml = .github\workflows\PR-CodeQL.yml
30+
.github\workflows\Pre-release-CI.yml = .github\workflows\Pre-release-CI.yml
31+
.github\workflows\Release-CI.yml = .github\workflows\Release-CI.yml
3032
EndProjectSection
3133
EndProject
3234
Global

0 commit comments

Comments
 (0)