Skip to content

Commit 04bedcd

Browse files
committed
Update build workflow
1 parent f15d33b commit 04bedcd

File tree

1 file changed

+28
-48
lines changed

1 file changed

+28
-48
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,32 @@ jobs:
5050
outputs:
5151
artifact-name: ${{ steps.set-vars.outputs.artifact-name }}
5252
steps:
53-
- name: checkout
54-
id: checkout
53+
- id: checkout
54+
name: checkout
5555
uses: actions/checkout@v4
56-
- name: setup-dotnet
57-
id: setup-dotnet
56+
- id: setup-dotnet
57+
name: setup-dotnet
5858
uses: actions/setup-dotnet@v4
5959
with:
6060
dotnet-version: 9.0.x
61-
- name: cache-restore
62-
id: cache-restore
61+
- id: cache-restore
62+
name: cache-restore
6363
uses: actions/cache/restore@v4
6464
with:
6565
path: ${{ env.PACKAGES }}
6666
key: ${{ runner.os }}-nuget
67-
- name: restore
68-
id: dotnet-restore
67+
- id: dotnet-restore
68+
name: restore
6969
run: dotnet restore .\src\SAM_NoTests.slnf --packages ${{ env.PACKAGES }}
70-
- name: cache-save
71-
id: cache-save
70+
- id: cache-save
71+
name: cache-save
7272
uses: actions/cache/save@v4
7373
if: steps.cache-restore.outputs.cache-hit != 'true'
7474
with:
7575
path: ${{ env.PACKAGES }}
7676
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
77-
- name: set-vars
78-
id: set-vars
77+
- id: set-vars
78+
name: set-vars
7979
run: |
8080
$now = Get-Date
8181
$longTs = $now.ToString('yyyy-MM-dd')
@@ -84,17 +84,10 @@ jobs:
8484
$artifactName = $buildType -eq 'release' ? "SAM_${{ inputs.version }}" : [string]::Format('SAM_{0}_{1}.{2}', $buildType, $ts, '${{ github.run_number }}')
8585
$configuration = $buildType -eq 'release' ? 'Release' : 'Debug'
8686
87-
Write-Host "Build Date : " -NoNewLine
88-
Write-Host "$($PSStyle.Foreground.BrightCyan)$longTs ($ts)$($PSStyle.Reset)"
89-
90-
Write-Host "Build Type : " -NoNewLine
91-
Write-Host "$($PSStyle.Foreground.BrightCyan)$buildType$($PSStyle.Reset)"
92-
93-
Write-Host "Artifact Name : " -NoNewLine
94-
Write-Host "$($PSStyle.Foreground.BrightCyan)$artifactName$($PSStyle.Reset)"
95-
96-
Write-Host "Configuration : " -NoNewLine
97-
Write-Host "$($PSStyle.Foreground.BrightCyan)$configuration$($PSStyle.Reset)"
87+
Write-Host "Build Date : $($PSStyle.Foreground.BrightCyan)$longTs ($ts)$($PSStyle.Reset)"
88+
Write-Host "Build Type : $($PSStyle.Foreground.BrightCyan)$buildType$($PSStyle.Reset)"
89+
Write-Host "Artifact Name : $($PSStyle.Foreground.BrightCyan)$artifactName$($PSStyle.Reset)"
90+
Write-Host "Configuration : $($PSStyle.Foreground.BrightCyan)$configuration$($PSStyle.Reset)"
9891
9992
echo "BUILD_DATE=$ts" >> $env:GITHUB_ENV
10093
echo "BUILD_DATE_LONG=$longTs" >> $env:GITHUB_ENV
@@ -103,19 +96,16 @@ jobs:
10396
echo "ARTIFACT_NAME=$artifactName" >> $env:GITHUB_ENV
10497
10598
echo "artifact-name=$artifactName" >> $env:GITHUB_OUTPUT
106-
- name: publish
107-
id: publish
99+
- id: publish
100+
name: publish
108101
run: dotnet publish .\src\SAM\SAM.csproj -o publish -c ${{ env.CONFIGURATION }} -a x86 --no-restore /p:Version=${{ inputs.version || env.VERSION }}
109-
- name: stage-artifacts
110-
id: stage-artifacts
102+
- id: stage-artifacts
103+
name: stage-artifacts
111104
run: |
112105
$publishDir = Get-Item publish | Select-Object -ExpandProperty FullName
113-
114106
$stagedFiles = gci $publishDir -Recurse -File | Sort-Object Extension, FullName | select -ExpandProperty FullName
115107
116-
Write-Host ""
117-
Write-Host "$($PSStyle.Bold)Staged Artifacts$($PSStyle.BoldOff)"
118-
Write-Host ""
108+
Write-Host "`n$($PSStyle.Bold)Staged Artifacts$($PSStyle.BoldOff)`n"
119109
120110
foreach ($stagedFile in $stagedFiles)
121111
{
@@ -124,26 +114,16 @@ jobs:
124114
125115
$color = ''
126116
127-
if ($ext -eq '.exe') {
128-
$color = $PSStyle.Foreground.BrightCyan
129-
}
130-
elseif ($ext -eq '.dll') {
131-
$color = $PSStyle.Foreground.BrightMagenta
132-
}
133-
elseif ($ext -eq '.pdb') {
134-
$color = $PSStyle.Foreground.BrightGreen
135-
}
136-
elseif ($ext -eq '.json' -or $ext -eq '.config') {
137-
$color = $PSStyle.Foreground.BrightBlue
138-
}
139-
else {
140-
$color = $PSStyle.Foreground.BrightWhite
141-
}
117+
if ($ext -eq '.exe') { $color = $PSStyle.Foreground.BrightCyan }
118+
elseif ($ext -eq '.dll') { $color = $PSStyle.Foreground.BrightMagenta }
119+
elseif ($ext -eq '.pdb') { $color = $PSStyle.Foreground.BrightGreen }
120+
elseif ($ext -eq '.json' -or $ext -eq '.config') { $color = $PSStyle.Foreground.BrightBlue }
121+
else { $color = $PSStyle.Foreground.BrightWhite }
142122
143123
Write-Host "- $color$relPath$($PSStyle.Reset)"
144124
}
145-
- name: upload
146-
id: artifact-upload
125+
- id: artifact-upload
126+
name: upload
147127
uses: actions/upload-artifact@v4
148128
with:
149129
name: ${{ env.ARTIFACT_NAME }}

0 commit comments

Comments
 (0)