feat: Update build configuration and dependencies for Catalog Lite, including executable naming and validation improvements
This commit is contained in:
parent
03dfe0f3a1
commit
ddf47ad51b
4 changed files with 75 additions and 39 deletions
|
|
@ -8,11 +8,6 @@ on:
|
||||||
required: true
|
required: true
|
||||||
default: '2026-12-31'
|
default: '2026-12-31'
|
||||||
type: string
|
type: string
|
||||||
publish_release:
|
|
||||||
description: Publish Forgejo release when running on a tag ref
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOTNET_VERSION: 10.0.x
|
DOTNET_VERSION: 10.0.x
|
||||||
|
|
@ -28,8 +23,10 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- runtime: win-x64
|
- runtime: win-x64
|
||||||
artifact_name: catalog-lite-win-x64
|
artifact_name: catalog-lite-win-x64
|
||||||
|
executable_name: CatalogLite.exe
|
||||||
- runtime: linux-x64
|
- runtime: linux-x64
|
||||||
artifact_name: catalog-lite-linux-x64
|
artifact_name: catalog-lite-linux-x64
|
||||||
|
executable_name: CatalogLite
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -62,12 +59,15 @@ jobs:
|
||||||
dotnet publish "${{ env.PROJECT_PATH }}" \
|
dotnet publish "${{ env.PROJECT_PATH }}" \
|
||||||
-c Release \
|
-c Release \
|
||||||
-r "${{ matrix.runtime }}" \
|
-r "${{ matrix.runtime }}" \
|
||||||
--self-contained true \
|
--self-contained false \
|
||||||
--no-restore \
|
--no-restore \
|
||||||
-p:CatalogLiteExpirationDate="${CATALOG_LITE_EXPIRATION_DATE}" \
|
-p:CatalogLiteExpirationDate="${CATALOG_LITE_EXPIRATION_DATE}" \
|
||||||
-p:PublishSingleFile=true \
|
-p:PublishSingleFile=true \
|
||||||
|
-p:SelfContained=false \
|
||||||
|
-p:IncludeNativeLibrariesForSelfExtract=true \
|
||||||
-p:PublishTrimmed=false \
|
-p:PublishTrimmed=false \
|
||||||
-p:PublishReadyToRun=false \
|
-p:PublishReadyToRun=false \
|
||||||
|
-p:DebugType=embedded \
|
||||||
-o "${PUBLISH_DIR}"
|
-o "${PUBLISH_DIR}"
|
||||||
|
|
||||||
- name: Validate published files
|
- name: Validate published files
|
||||||
|
|
@ -75,14 +75,23 @@ jobs:
|
||||||
PUBLISH_DIR: artifacts/publish/${{ matrix.runtime }}
|
PUBLISH_DIR: artifacts/publish/${{ matrix.runtime }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
if [ "${{ matrix.runtime }}" = "win-x64" ]; then
|
executable="${PUBLISH_DIR}/${{ matrix.executable_name }}"
|
||||||
file_count="$(find "${PUBLISH_DIR}" -maxdepth 1 -type f -iname '*.exe' | wc -l | tr -d ' ')"
|
if [ ! -f "${executable}" ]; then
|
||||||
else
|
echo "Catalog Lite executable was not produced: ${executable}"
|
||||||
file_count="$(find "${PUBLISH_DIR}" -maxdepth 1 -type f -name 'CatalogLite' | wc -l | tr -d ' ')"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${file_count}" -eq 0 ]; then
|
loose_library_count="$(find "${PUBLISH_DIR}" -maxdepth 1 -type f \( -iname '*.dll' -o -name '*.so' -o -name '*.dylib' \) | wc -l | tr -d ' ')"
|
||||||
echo "No Catalog Lite executable produced in ${PUBLISH_DIR}"
|
if [ "${loose_library_count}" -ne 0 ]; then
|
||||||
|
echo "Catalog Lite publish must not contain loose native or managed libraries:"
|
||||||
|
find "${PUBLISH_DIR}" -maxdepth 1 -type f \( -iname '*.dll' -o -name '*.so' -o -name '*.dylib' \) -print
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
extra_file_count="$(find "${PUBLISH_DIR}" -maxdepth 1 -type f ! -name "${{ matrix.executable_name }}" | wc -l | tr -d ' ')"
|
||||||
|
if [ "${extra_file_count}" -ne 0 ]; then
|
||||||
|
echo "Catalog Lite publish artifact must contain only ${{ matrix.executable_name }}:"
|
||||||
|
find "${PUBLISH_DIR}" -maxdepth 1 -type f ! -name "${{ matrix.executable_name }}" -print
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -90,11 +99,10 @@ jobs:
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.artifact_name }}
|
name: ${{ matrix.artifact_name }}
|
||||||
path: artifacts/publish/${{ matrix.runtime }}
|
path: artifacts/publish/${{ matrix.runtime }}/${{ matrix.executable_name }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
release:
|
release:
|
||||||
if: inputs.publish_release && startsWith(forgejo.ref, 'refs/tags/')
|
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
env:
|
env:
|
||||||
|
|
@ -107,12 +115,6 @@ jobs:
|
||||||
name: catalog-lite-win-x64
|
name: catalog-lite-win-x64
|
||||||
path: artifacts/release/win-x64
|
path: artifacts/release/win-x64
|
||||||
|
|
||||||
- name: Download Linux artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: catalog-lite-linux-x64
|
|
||||||
path: artifacts/release/linux-x64
|
|
||||||
|
|
||||||
- name: Validate release token
|
- name: Validate release token
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
|
@ -125,8 +127,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
api_base="${FORGEJO_SERVER_URL%/}/api/v1/repos/${FORGEJO_REPOSITORY}"
|
api_base="${FORGEJO_SERVER_URL%/}/api/v1/repos/${FORGEJO_REPOSITORY}"
|
||||||
tag="${FORGEJO_REF_NAME}"
|
tag="catalog-lite-${CATALOG_LITE_EXPIRATION_DATE}"
|
||||||
create_payload="$(printf '{"tag_name":"%s","name":"%s","body":"Catalog Lite\\n\\nScadenza build: %s","draft":false,"prerelease":false}' "${tag}" "${tag}" "${CATALOG_LITE_EXPIRATION_DATE}")"
|
name="Catalog Lite ${CATALOG_LITE_EXPIRATION_DATE}"
|
||||||
|
commit="${FORGEJO_SHA:-${GITHUB_SHA:-}}"
|
||||||
|
create_payload="$(printf '{"tag_name":"%s","target_commitish":"%s","name":"%s","body":"Catalog Lite\\n\\nScadenza build: %s","draft":false,"prerelease":false}' "${tag}" "${commit}" "${name}" "${CATALOG_LITE_EXPIRATION_DATE}")"
|
||||||
update_payload="$(printf '{"body":"Catalog Lite\\n\\nScadenza build: %s"}' "${CATALOG_LITE_EXPIRATION_DATE}")"
|
update_payload="$(printf '{"body":"Catalog Lite\\n\\nScadenza build: %s"}' "${CATALOG_LITE_EXPIRATION_DATE}")"
|
||||||
|
|
||||||
http_code="$(curl -sS -o release.json -w '%{http_code}' \
|
http_code="$(curl -sS -o release.json -w '%{http_code}' \
|
||||||
|
|
@ -169,23 +173,25 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
api_base="${FORGEJO_SERVER_URL%/}/api/v1/repos/${FORGEJO_REPOSITORY}"
|
api_base="${FORGEJO_SERVER_URL%/}/api/v1/repos/${FORGEJO_REPOSITORY}"
|
||||||
short_sha="$(printf '%s' "${FORGEJO_SHA}" | cut -c1-12)"
|
|
||||||
|
|
||||||
windows_exe="$(find artifacts/release/win-x64 -maxdepth 1 -type f -iname '*.exe' | head -n1)"
|
windows_exe="$(find artifacts/release/win-x64 -maxdepth 1 -type f -iname '*.exe' | head -n1)"
|
||||||
linux_exe="$(find artifacts/release/linux-x64 -maxdepth 1 -type f -name 'CatalogLite' | head -n1)"
|
|
||||||
|
|
||||||
if [ -z "${windows_exe}" ]; then
|
if [ -z "${windows_exe}" ]; then
|
||||||
echo "No Windows executable found in downloaded artifact"
|
echo "No Windows executable found in downloaded artifact"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${linux_exe}" ]; then
|
curl -fsS \
|
||||||
echo "No Linux executable found in downloaded artifact"
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
exit 1
|
"${api_base}/releases/${RELEASE_ID}/assets" \
|
||||||
fi
|
-o assets.json
|
||||||
|
|
||||||
linux_archive="CatalogLite-linux-x64-${FORGEJO_REF_NAME}-${short_sha}.tar.gz"
|
for asset_id in $(tr '{' '\n' < assets.json | sed -n 's/.*"id":\([0-9][0-9]*\).*"name":"[^"]*".*/\1/p'); do
|
||||||
tar -czf "${linux_archive}" -C "$(dirname "${linux_exe}")" "$(basename "${linux_exe}")"
|
curl -fsS \
|
||||||
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
-X DELETE \
|
||||||
|
"${api_base}/releases/${RELEASE_ID}/assets/${asset_id}"
|
||||||
|
done
|
||||||
|
|
||||||
upload_asset() {
|
upload_asset() {
|
||||||
asset_path="$1"
|
asset_path="$1"
|
||||||
|
|
@ -197,5 +203,4 @@ jobs:
|
||||||
"${api_base}/releases/${RELEASE_ID}/assets?name=${asset_name}"
|
"${api_base}/releases/${RELEASE_ID}/assets?name=${asset_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
upload_asset "${windows_exe}" "CatalogLite-win-x64-${FORGEJO_REF_NAME}-${short_sha}.exe"
|
upload_asset "${windows_exe}" "CatalogLite-${CATALOG_LITE_EXPIRATION_DATE}.exe"
|
||||||
upload_asset "${linux_archive}" "${linux_archive}"
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,6 @@
|
||||||
<Style Selector="ProgressBar">
|
<Style Selector="ProgressBar">
|
||||||
<Setter Property="MinHeight" Value="18" />
|
<Setter Property="MinHeight" Value="18" />
|
||||||
</Style>
|
</Style>
|
||||||
<StyleInclude Source="avares://IconPacks.Avalonia/Icons.axaml" />
|
<StyleInclude Source="avares://IconPacks.Avalonia.Material/Material.axaml" />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
|
|
@ -8,6 +8,14 @@
|
||||||
<RootNamespace>CatalogLite</RootNamespace>
|
<RootNamespace>CatalogLite</RootNamespace>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
||||||
<CatalogLiteExpirationDate Condition="'$(CatalogLiteExpirationDate)' == ''">2026-12-31</CatalogLiteExpirationDate>
|
<CatalogLiteExpirationDate Condition="'$(CatalogLiteExpirationDate)' == ''">2026-12-31</CatalogLiteExpirationDate>
|
||||||
|
<EnableMaddoSharedGdi>false</EnableMaddoSharedGdi>
|
||||||
|
<UseAppHost>true</UseAppHost>
|
||||||
|
<SelfContained>false</SelfContained>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
|
<PublishReadyToRun>false</PublishReadyToRun>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64' Or '$(RuntimeIdentifier)' == 'win-arm64'">
|
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64' Or '$(RuntimeIdentifier)' == 'win-arm64'">
|
||||||
|
|
@ -19,14 +27,14 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MaddoShared\MaddoShared.csproj" />
|
<ProjectReference Include="..\MaddoShared\MaddoShared.csproj" SetTargetFramework="TargetFramework=net10.0;EnableMaddoSharedGdi=false" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="11.3.13" />
|
<PackageReference Include="Avalonia" Version="11.3.13" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.13" />
|
<PackageReference Include="Avalonia.Desktop" Version="11.3.13" />
|
||||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.13" />
|
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.13" />
|
||||||
<PackageReference Include="IconPacks.Avalonia" Version="2.0.0" />
|
<PackageReference Include="IconPacks.Avalonia.Material" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.8" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
|
||||||
|
|
@ -45,4 +53,25 @@
|
||||||
Overwrite="true"
|
Overwrite="true"
|
||||||
Lines="using System.Reflection%3B

[assembly: AssemblyMetadata("CatalogLiteGeneratedExpirationDate", "$(CatalogLiteExpirationDate)")]
[assembly: AssemblyMetadata("CatalogLiteExpirationDate", "$(CatalogLiteExpirationDate)")]

namespace CatalogLite%3B

internal static class BuildExpiration
{
 public const string ExpirationDate = "$(CatalogLiteExpirationDate)"%3B
}" />
|
Lines="using System.Reflection%3B

[assembly: AssemblyMetadata("CatalogLiteGeneratedExpirationDate", "$(CatalogLiteExpirationDate)")]
[assembly: AssemblyMetadata("CatalogLiteExpirationDate", "$(CatalogLiteExpirationDate)")]

namespace CatalogLite%3B

internal static class BuildExpiration
{
 public const string ExpirationDate = "$(CatalogLiteExpirationDate)"%3B
}" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="ValidateCatalogLiteFeatureDependencies" AfterTargets="ResolveReferences">
|
||||||
|
<ItemGroup>
|
||||||
|
<_CatalogLiteForbiddenReference Include="@(ReferencePath)" Condition="$([System.String]::Copy('%(FileName)').StartsWith('AIFotoONLUS')) Or '%(FileName)' == 'Catalog.Communication' Or '%(FileName)' == 'Microsoft.Windows.Compatibility' Or '%(FileName)' == 'System.Drawing.Common' Or '%(FileName)' == 'System.Private.Windows.GdiPlus' Or '%(FileName)' == 'System.Windows.Extensions'" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Error Condition="'@(_CatalogLiteForbiddenReference)' != ''" Text="Catalog Lite must not reference AI or race upload assemblies: @(_CatalogLiteForbiddenReference->'%(FileName)%(Extension)', ', ')" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PruneCatalogLitePublishSidecars" AfterTargets="Publish" Condition="'$(PublishDir)' != '' And '$(PublishSingleFile)' == 'true'">
|
||||||
|
<ItemGroup>
|
||||||
|
<_CatalogLiteSidecarFile Include="$(PublishDir)**\*.dll.config;$(PublishDir)**\*.pdb" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Delete Files="@(_CatalogLiteSidecarFile)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="ValidateCatalogLitePublishOutput" AfterTargets="PruneCatalogLitePublishSidecars" Condition="'$(PublishDir)' != '' And '$(PublishSingleFile)' == 'true'">
|
||||||
|
<ItemGroup>
|
||||||
|
<_CatalogLiteLooseNativeFile Include="$(PublishDir)**\*.dll;$(PublishDir)**\*.so;$(PublishDir)**\*.dylib" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Error Condition="'@(_CatalogLiteLooseNativeFile)' != ''" Text="Catalog Lite single-file publish produced loose native/managed library files: @(_CatalogLiteLooseNativeFile->'%(Filename)%(Extension)', ', ')" />
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFrameworks>net10.0;net10.0-windows</TargetFrameworks>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<!-- WINDOWS preprocessor symbol mirrors the -windows TFM suffix so #if WINDOWS guards work -->
|
<EnableMaddoSharedGdi Condition="'$(EnableMaddoSharedGdi)' == '' and '$(TargetFramework)' == 'net10.0-windows'">true</EnableMaddoSharedGdi>
|
||||||
<DefineConstants Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(DefineConstants);WINDOWS</DefineConstants>
|
<EnableMaddoSharedGdi Condition="'$(EnableMaddoSharedGdi)' == ''">false</EnableMaddoSharedGdi>
|
||||||
|
<!-- WINDOWS preprocessor symbol enables the optional GDI image creator. -->
|
||||||
|
<DefineConstants Condition="'$(EnableMaddoSharedGdi)' == 'true'">$(DefineConstants);WINDOWS</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AsyncEnumerator" Version="4.0.2" />
|
<PackageReference Include="AsyncEnumerator" Version="4.0.2" />
|
||||||
|
|
@ -31,6 +33,6 @@
|
||||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.3" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
|
<PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.3" Condition="'$(EnableMaddoSharedGdi)' == 'true'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue