Skip to content

Commit cc0154b

Browse files
committed
Update ci script
1 parent 3757a76 commit cc0154b

File tree

3 files changed

+47
-17
lines changed

3 files changed

+47
-17
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@
3636
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
3737
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
3838

39-
name: Build NuGet Package
39+
name: Make release
4040

4141
on:
42-
release:
43-
types: [published]
42+
workflow_dispatch:
4443

4544
jobs:
4645

4746
build:
47+
48+
environment: release
4849

4950
strategy:
5051
matrix:
@@ -55,8 +56,8 @@ jobs:
5556

5657
env:
5758
Project_Directory: NiL.JS
58-
Solution_Name: $Project_Directory/NiL.JS.csproj # Replace with your solution name, i.e. MyWpfApp.sln.
59-
Test_Project_Path: Tests/Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
59+
Solution_Name: $Project_Directory/NiL.JS.csproj
60+
Test_Project_Path: Tests/Tests.csproj
6061
Nuget_Pack_Output_Directory: nuget
6162

6263
steps:
@@ -101,16 +102,13 @@ jobs:
101102
$certificatePath = Join-Path -Path $env:Project_Directory -ChildPath keys.snk
102103
[IO.File]::WriteAllBytes("$certificatePath", $snk_byte)
103104
104-
# Execute all unit tests in the solution
105-
- name: Execute unit tests on .NET Core 6.0
106-
run: |
107-
cd Tests
108-
dotnet run --project ..\Utility\tiny-t4\ --framework net6.0
109-
dotnet test -c Release -property:TargetFramework=net6.0 -property:SignAssembly=false -property:PublicSign=false
110-
105+
111106
# Create the app package by building and packaging the Windows Application Packaging project
112107
- name: Create the app package
113-
run: ./pack.ps1
108+
run: |
109+
$VERSION=${{ vars.VERSION }}
110+
echo $VERSION
111+
./pack.ps1
114112
115113
# Remove the pfx
116114
- name: Remove the snk
@@ -122,3 +120,27 @@ jobs:
122120
with:
123121
name: NuGet Package
124122
path: ${{ env.Nuget_Pack_Output_Directory }}
123+
124+
- name: Make release tag
125+
id: tag
126+
run: |
127+
echo $VERSION
128+
$TAG="${{ vars.VERSION }}.$(git rev-list --count origin/develop)"
129+
echo "tag=$TAG" >> $env:GITHUB_OUTPUT
130+
echo $GITHUB_OUTPUT
131+
echo $env:GITHUB_OUTPUT
132+
git tag $TAG
133+
git push --tags
134+
135+
- name: Build release message
136+
run: |
137+
echo ${{ steps.tag.outputs.tag }}
138+
./buildReleaseMessage.ps1 > ./release.md
139+
140+
- name: Make release ${{ steps.tag.outputs.tag }}
141+
uses: ncipollo/release-action@v1
142+
with:
143+
tag: ${{ steps.tag.outputs.tag }}
144+
name: ${{ steps.tag.outputs.tag }}
145+
artifacts: ${{ env.Nuget_Pack_Output_Directory }}/*
146+
bodyFile: ./release.md

buildReleaseMessage.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$URL=$(git remote get-url origin).Replace('.git', '') + "/commit/";
2+
$COMMITS=$(git cherry $($(git describe --tags).Split('-')[0]) HEAD)
3+
foreach ($commit in $COMMITS){
4+
$commit=$commit.Replace('+', '').Trim();
5+
$message=(iex (echo "git show -s --format=%B $($commit)"));
6+
$message="[$(iex "echo $($message.Replace("'", "''''"))")](" + $URL + $commit + ")";
7+
echo $message;
8+
}

pack.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ mkdir nuget -erroraction 'silentlycontinue'
66
$REVISION=$(git rev-list --count origin/develop)
77
[System.IO.File]::WriteAllText("$(get-location)\\NiL.JS\\Properties\\InternalInfo.cs","internal static class InternalInfo
88
{
9-
internal const string Version = ""2.5.$($REVISION)"";
9+
internal const string Version = ""$VERSION.$($REVISION)"";
1010
internal const string Year = ""$(get-date -Format yyyy)"";
1111
}")
1212
cd NiL.JS
13-
dotnet build -c Release -property:VersionPrefix=2.5.$($REVISION) -property:SignAssembly=true
14-
dotnet pack -c Release -property:VersionPrefix=2.5.$($REVISION) -property:SignAssembly=true
15-
mv -Force bin/release/NiL.JS.2.5.$($REVISION).nupkg ../nuget/NiL.JS.2.5.$($REVISION).nupkg
13+
dotnet build -c Release -property:VersionPrefix=$VERSION.$($REVISION) -property:SignAssembly=true
14+
dotnet pack -c Release -property:VersionPrefix=$VERSION.$($REVISION) -property:SignAssembly=true
15+
mv -Force bin/release/NiL.JS.$VERSION.$($REVISION).nupkg ../nuget/NiL.JS.$VERSION.$($REVISION).nupkg
1616
cd ..

0 commit comments

Comments
 (0)