Skip to content

Commit

Permalink
Updated build.yml and create_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
syntax-tm committed May 12, 2024
1 parent f1ee8b8 commit ff60b18
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Build
env:
ARTIFACT: SAM
PACKAGES: ${{ github.workspace }}\.nuget\packages
VERSION_PREFIX: 0.0.1
VERSION_SUFFIX: alpha
VERSION: 0.0.1-alpha

on:
workflow_call:
Expand All @@ -13,14 +12,9 @@ on:
description: 'True if this build is for a release, false otherwise'
default: false
type: boolean
version-prefix:
description: 'The version prefix (e.g. "1.0.0")'
default: '0.0.1'
required: false
type: string
version-suffix:
description: 'The version suffix (e.g. "alpha")'
default: ''
version:
description: 'The semantic version number (e.g. "2.0.1-beta")'
default: '0.0.1-alpha'
required: false
type: string
workflow_dispatch:
Expand Down Expand Up @@ -63,9 +57,9 @@ jobs:
path: ${{ env.PACKAGES }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Publish SAM
run: dotnet publish .\src\SAM\SAM.csproj -o publish -c Release -a x86 --no-restore /p:VersionPrefix=${{ inputs.version-prefix || env.VERSION_PREFIX }} /p:VersionSuffix=${{ inputs.version-suffix || env.VERSION_SUFFIX }}
run: dotnet publish .\src\SAM\SAM.csproj -o publish -c Release -a x86 --no-restore /p:Version=${{ inputs.version || env.VERSION }}
- name: Publish SAM.Manager
run: dotnet publish .\src\SAM.Manager\SAM.Manager.csproj -o publish_manager -c Release -a x86 --no-restore /p:VersionPrefix=${{ inputs.version-prefix || env.VERSION_PREFIX }} /p:VersionSuffix=${{ inputs.version-suffix || env.VERSION_SUFFIX }}
run: dotnet publish .\src\SAM.Manager\SAM.Manager.csproj -o publish_manager -c Release -a x86 --no-restore /p:Version=${{ inputs.version || env.VERSION }}
- name: Stage Artifacts
run: |
$samDir = Get-Item publish | Select-Object -ExpandProperty FullName
Expand All @@ -76,29 +70,32 @@ jobs:
$stagedFiles = gci $samDir -Recurse -File | select -ExpandProperty FullName | Sort-Object
Write-Host ""
Write-Host "`nStaged Artifacts:`n" -ForegroundColor Cyan
Write-Host "::group::Staged Artifacts"
foreach ($stagedFile in $stagedFiles)
{
$relPath = [System.IO.Path]::GetRelativePath($samDir, $stagedFile)
$ext = [System.IO.Path]::GetExtension($stagedFile)
$color = ''
if ($ext -eq '.exe') {
Write-Host "- $relPath" -ForegroundColor Cyan
$color = $PSStyle.Foreground.BrightCyan
}
elseif ($ext -eq '.dll') {
Write-Host "- $relPath" -ForegroundColor Magenta
$color = $PSStyle.Foreground.BrightMagenta
}
elseif ($ext -eq '.pdb') {
Write-Host "- $relPath" -ForegroundColor Green
$color = $PSStyle.Foreground.BrightGreen
}
elseif ($ext -eq '.json') {
Write-Host "- $relPath" -ForegroundColor Blue
}
else {
Write-Host "- $relPath"
elseif ($ext -eq '.json' -or $ext -eq '.config') {
$color = $PSStyle.Foreground.BrightBlue
}
Write-Host "- $color$relPath$($PSStyle.Reset)"
}
Write-Host "::endgroup::"
- name: Upload a Build Artifact
id: artifact-upload
uses: actions/upload-artifact@v3
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
permissions:
contents: write
outputs:
version: ${{ steps.validate-version.outputs.version }}
version-prefix: ${{ steps.validate-version.outputs.version-prefix }}
version-suffix: ${{ steps.validate-version.outputs.version-suffix }}
steps:
Expand Down Expand Up @@ -51,15 +52,15 @@ jobs:
Write-Host ""
echo "version=version" >> $env:GITHUB_OUTPUT
echo "version-prefix=$prefix" >> $env:GITHUB_OUTPUT
echo "version-suffix=$suffix" >> $env:GITHUB_OUTPUT
build:
uses: syntax-tm/SteamAchievementManager/.github/workflows/build.yml@main
needs: setup
with:
is_release: true
version-prefix: ${{ needs.setup.outputs.version-prefix }}
version-suffix: ${{ needs.setup.outputs.version-suffix }}
version: ${{ needs.setup.outputs.version }}
create-release:
runs-on: windows-latest
needs: [build]
Expand Down
1 change: 1 addition & 0 deletions src/SAM.API/SAM.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageTags>sam;steam;steamworks;games;achievement;manager;valve;api;stats;</PackageTags>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
1 change: 1 addition & 0 deletions src/SAM.Core/SAM.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<UseWPF>true</UseWPF>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
4 changes: 3 additions & 1 deletion src/SAM.Manager/SAM.Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<!--<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<_SuppressWpfTrimError>true</_SuppressWpfTrimError>-->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
Expand Down Expand Up @@ -94,7 +95,8 @@
</None>
</ItemGroup>

<Target Name="AddRuntimeDependenciesToContent" Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $(Configuration) == 'Debug' " BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="GenerateBuildDependencyFile;GenerateBuildRuntimeConfigurationFiles">
<!-- this does not run on publish. this copies this project's output to the main (SAM) project's output folder when on build -->
<Target Name="AddRuntimeDependenciesToContent" Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $(_IsPublishing) == '' " BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="GenerateBuildDependencyFile;GenerateBuildRuntimeConfigurationFiles">
<ItemGroup>
<ContentWithTargetPath Include="$(ProjectDepsFilePath)" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectDepsFileName)" />
<ContentWithTargetPath Include="$(ProjectRuntimeConfigFilePath)" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectRuntimeConfigFileName)" />
Expand Down
1 change: 1 addition & 0 deletions src/SAM/SAM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<!--<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<_SuppressWpfTrimError>true</_SuppressWpfTrimError>-->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
Expand Down

0 comments on commit ff60b18

Please sign in to comment.