mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2024-12-23 06:56:27 +00:00
release CI
This commit is contained in:
parent
b98313b74f
commit
11c68c818d
82
.github/workflows/build-release.yml
vendored
82
.github/workflows/build-release.yml
vendored
@ -12,79 +12,48 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
env:
|
||||||
update-packagejson:
|
GIT_TAG: ${{ github.event.inputs.tag }}
|
||||||
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
|
DRY_RUN: ${{ github.event.inputs.dry-run }}
|
||||||
with:
|
|
||||||
file-path: ./src/MemoryPack.Unity/Assets/Plugins/MemoryPack/package.json
|
|
||||||
tag: ${{ inputs.tag }}
|
|
||||||
dry-run: ${{ inputs.dry-run }}
|
|
||||||
push-tag: false
|
|
||||||
|
|
||||||
build-dotnet:
|
jobs:
|
||||||
needs: [update-packagejson]
|
build-and-push-rust:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- run: cargo build --verbose
|
||||||
|
- run: cargo test update_package_version -- {{ inputs.tag }} --nocapture
|
||||||
|
- name: Push changes
|
||||||
|
uses: ad-m/github-push-action@master
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ github.ref }}
|
||||||
|
tags: false
|
||||||
|
- run: cargo publish --manifest-path csbindgen/Cargo.toml
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
build-dotnet:
|
||||||
|
needs: [build-and-push-rust]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: 7.0.x
|
||||||
6.0.x
|
|
||||||
7.0.x
|
|
||||||
# pack nuget
|
# pack nuget
|
||||||
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
|
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
|
||||||
- run: dotnet test -c Release --no-build
|
|
||||||
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
|
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: nuget
|
name: nuget
|
||||||
path: ./publish
|
path: ./publish
|
||||||
|
|
||||||
build-unity:
|
|
||||||
needs: [update-packagejson]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
unity: ["2021.3.11f1"]
|
|
||||||
include:
|
|
||||||
- unity: 2021.3.11f1
|
|
||||||
license: UNITY_LICENSE_2021
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
steps:
|
|
||||||
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
|
||||||
# Execute scripts: Export Package
|
|
||||||
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
|
||||||
- name: Export unitypackage
|
|
||||||
uses: game-ci/unity-builder@v2
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
|
||||||
with:
|
|
||||||
projectPath: src/MemoryPack.Unity
|
|
||||||
unityVersion: ${{ matrix.unity }}
|
|
||||||
targetPlatform: StandaloneLinux64
|
|
||||||
buildMethod: PackageExporter.Export
|
|
||||||
versioning: None
|
|
||||||
# check meta files
|
|
||||||
- uses: Cysharp/Actions/.github/actions/check-metas@main
|
|
||||||
with:
|
|
||||||
directory: src/MemoryPack.Unity
|
|
||||||
# Store artifacts.
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: MemoryPack.${{ inputs.tag }}.unitypackage
|
|
||||||
path: ./src/MemoryPack.Unity/MemoryPack.${{ inputs.tag }}.unitypackage
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
# release
|
# release
|
||||||
create-release:
|
create-release:
|
||||||
needs: [update-packagejson, build-dotnet, build-unity]
|
needs: [build-and-push-rust, build-dotnet]
|
||||||
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
|
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
|
||||||
with:
|
with:
|
||||||
dry-run: ${{ inputs.dry-run }}
|
dry-run: ${{ inputs.dry-run }}
|
||||||
@ -92,9 +61,6 @@ jobs:
|
|||||||
tag: ${{ inputs.tag }}
|
tag: ${{ inputs.tag }}
|
||||||
push-tag: true
|
push-tag: true
|
||||||
nuget-push: true
|
nuget-push: true
|
||||||
unitypackage-upload: true
|
|
||||||
unitypackage-name: MemoryPack.${{ inputs.tag }}.unitypackage
|
|
||||||
unitypackage-path: ./MemoryPack.${{ inputs.tag }}.unitypackage/MemoryPack.${{ inputs.tag }}.unitypackage
|
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -7,10 +7,29 @@
|
|||||||
<LangVersion>11</LangVersion>
|
<LangVersion>11</LangVersion>
|
||||||
<IsRoslynComponent>true</IsRoslynComponent>
|
<IsRoslynComponent>true</IsRoslynComponent>
|
||||||
<AnalyzerLanguage>cs</AnalyzerLanguage>
|
<AnalyzerLanguage>cs</AnalyzerLanguage>
|
||||||
|
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<DevelopmentDependency>true</DevelopmentDependency>
|
||||||
|
<IncludeSymbols>false</IncludeSymbols>
|
||||||
|
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
|
||||||
|
<PackageTags>interop</PackageTags>
|
||||||
|
|
||||||
|
<PackageId>csbindgen</PackageId>
|
||||||
|
<Description>Code generator for csbindgen.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="../Icon.png" Pack="true" PackagePath="/" />
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- for nuget publish -->
|
||||||
|
<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup">
|
||||||
|
<ItemGroup>
|
||||||
|
<TfmSpecificPackageFile Include="$(TargetDir)\*.dll" PackagePath="analyzers\dotnet\cs" />
|
||||||
|
<TfmSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')" PackagePath="analyzers\dotnet\cs\%(SatelliteDllsProjectOutputGroupOutput.Culture)\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -141,8 +141,11 @@ mod tests {
|
|||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
fs::{self},
|
fs::{self},
|
||||||
|
io::Write,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -179,9 +182,15 @@ mod tests {
|
|||||||
println!("current_dir: {}", path.display());
|
println!("current_dir: {}", path.display());
|
||||||
|
|
||||||
path.push("Cargo.toml");
|
path.push("Cargo.toml");
|
||||||
|
let toml = fs::read_to_string(path.clone()).unwrap();
|
||||||
|
|
||||||
let toml = fs::read_to_string(path).unwrap();
|
// replace only first-match
|
||||||
|
let regex = Regex::new("version = \".+\"").unwrap();
|
||||||
|
|
||||||
println!("current toml: {}", toml);
|
let new_toml = regex.replace(toml.as_str(), format!("version = \"{}\"", args[2]));
|
||||||
|
|
||||||
|
let mut file = fs::File::create(path.clone()).unwrap();
|
||||||
|
file.write_all(new_toml.as_bytes()).unwrap();
|
||||||
|
file.flush().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user