Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Dec 10, 2024
1 parent 6af5e8a commit 30dd095
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 61 deletions.
73 changes: 23 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,36 @@ on: [push, pull_request]

jobs:
build:

env:
BUILD_CONFIG: 'Release'
SOLUTION: 'PrismSharp.sln'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

# - name: Get Build Version
# run: |
# Import-Module .\scripts\GetBuildVersion.psm1
# Write-Host $Env:GITHUB_REF
# $version = GetBuildVersion -VersionString $Env:GITHUB_REF
# echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
# shell: pwsh

- name: Setup NuGet
uses: NuGet/[email protected]

# - name: Restore dependencies
# run: nuget restore $SOLUTION
submodules: 'recursive'

- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
dotnet-version: 9.x.x

- name: Restore dependencies by dotnet sdk
run: dotnet restore $SOLUTION

- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore

- name: Run tests
run: dotnet test --configuration $BUILD_CONFIG --no-restore --no-build --verbosity normal

- name: Pack
if: startsWith(github.ref, 'refs/tags/')
run: >-
dotnet build PrismSharp.RegExCompiler/PrismSharp.RegExCompiler.csproj --configuration Release;
dotnet build PrismSharp.SourceGenerator/PrismSharp.SourceGenerator.csproj --configuration Release;
dotnet build PrismSharp.Core/PrismSharp.Core.csproj --configuration Release;
dotnet pack PrismSharp.Core/PrismSharp.Core.csproj --configuration Release -o "./packages";
shell: pwsh


- name: Push to NuGet
run: dotnet nuget push "./packages/*.nupkg" -k ${{secrets.NUGET_API_KEY}} -s https://www.nuget.org
shell: pwsh

- name: Push to GPR
run: |
dotnet pack --configuration $BUILD_CONFIG --no-restore --no-build --verbosity normal
for f in ./packages/*.nupkg
do
curl -vX PUT -u "vslee:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/BUTR/
done
shell: bash

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
**/*.nupkg
# TODO: create changelog.md
# body_path: changelog.md

- name: Publish to nuget.org
if: startsWith(github.ref, 'refs/tags/')
run: |
dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}}
21 changes: 10 additions & 11 deletions PrismSharp.Core/PrismSharp.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>PrismSharp.Core</PackageId>
<Version>0.1.4</Version>
<Description>A porting of PrismJS to C# or .NET.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Nullable>enable</Nullable>
<TargetFrameworks>net45;netstandard2.0;net8.0;net9.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<RepositoryUrl>https://github.com/tatwd/prism-sharp</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>

<GITHUB_RUN_NUMBER Condition="$(GITHUB_RUN_NUMBER) == ''">0</GITHUB_RUN_NUMBER>
<Version>1.0.0.$(GITHUB_RUN_NUMBER)</Version>

<PackageOutputPath>$(MSBuildThisFileDirectory)..\packages\</PackageOutputPath>
<PackBuildOutput>true</PackBuildOutput>

<NuspecFile>$(MSBuildThisFileDirectory)PrismSharp.Core.nuspec</NuspecFile>
<NuspecProperties>Version=$(Version);Configuration=$(Configuration)</NuspecProperties>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\SimpleJSON\SimpleJSON.cs">
<Link>SimpleJSON.cs</Link>
Expand Down
31 changes: 31 additions & 0 deletions PrismSharp.Core/PrismSharp.Core.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>BUTR.PrismSharp.Core</id>
<version>$version$</version>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>A porting of PrismJS to C# or .NET. Fork for BUTR use.</description>
</metadata>
<files>
<file src="bin\$configuration$\netstandard2.0\PrismSharp.Core.dll" target="lib\netstandard2.0\PrismSharp.Core.dll" />
<file src="bin\$configuration$\netstandard2.0\PrismSharp.Core.pdb" target="lib\netstandard2.0\PrismSharp.Core.pdb" />
<file src="bin\$configuration$\netstandard2.0\PrismSharp.RegEx.dll" target="lib\netstandard2.0\PrismSharp.RegEx.dll" />

<file src="bin\$configuration$\net45\PrismSharp.Core.dll" target="lib\net45\PrismSharp.Core.dll" />
<file src="bin\$configuration$\net45\PrismSharp.Core.pdb" target="lib\net45\PrismSharp.Core.pdb" />
<file src="bin\$configuration$\net45\PrismSharp.RegEx.dll" target="lib\net45\PrismSharp.RegEx.dll" />

<file src="bin\$configuration$\net8.0\PrismSharp.Core.dll" target="lib\net8.0\PrismSharp.Core.dll" />
<file src="bin\$configuration$\net8.0\PrismSharp.Core.pdb" target="lib\net8.0\PrismSharp.Core.pdb" />
<file src="bin\$configuration$\net8.0\PrismSharp.RegEx.dll" target="lib\net8.0\PrismSharp.RegEx.dll" />
<file src="bin\$configuration$\net8.0\PrismSharp.RegEx.pdb" target="lib\net8.0\PrismSharp.RegEx.pdb" />

<file src="bin\$configuration$\net9.0\PrismSharp.Core.dll" target="lib\net9.0\PrismSharp.Core.dll" />
<file src="bin\$configuration$\net9.0\PrismSharp.Core.pdb" target="lib\net9.0\PrismSharp.Core.pdb" />
<file src="bin\$configuration$\net9.0\PrismSharp.RegEx.dll" target="lib\net9.0\PrismSharp.RegEx.dll" />
<file src="bin\$configuration$\net9.0\PrismSharp.RegEx.pdb" target="lib\net9.0\PrismSharp.RegEx.pdb" />

<file src="README.md" target="README.md" />
</files>
</package>

0 comments on commit 30dd095

Please sign in to comment.