diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2b95506..afb2d77 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,7 +7,7 @@ on:
branches: [ master ]
permissions:
- contents: read
+ contents: write
packages: write
env:
@@ -70,7 +70,14 @@ jobs:
- name: Build project
run: dotnet build --no-restore --configuration Release
+ - name: Make script executable
+ run: chmod +x ./CI_Pack_Push.ps1
+ shell: bash
+
- name: Publish to GitHub Packages
- run: |
- dotnet pack --configuration Release --no-build -o ./nupkg
- dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
+ shell: pwsh
+ run: ./CI_Pack_Push.ps1
+ env:
+ GITHUB_NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REPO: ${{ github.repository }}
+ REPO_OWNER: ${{ github.repository_owner }}
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..769b4af
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,90 @@
+name: Release
+
+on:
+ release:
+ types: [published]
+
+permissions:
+ contents: write
+ packages: write
+ # id-token: write
+
+env:
+ DOTNET_VERSION: "10.0.x"
+ NODE_VERSION: "20"
+
+jobs:
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: ~/.nuget/packages
+ key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build project
+ run: dotnet build --no-restore --configuration Release
+
+ - name: Run unit tests
+ run: dotnet test --no-build --verbosity normal --configuration Release /p:CollectCoverage=true /p:Threshold=50 /p:ThresholdType=line /p:ThresholdStat=Average /p:CoverletOutput=./TestResults/ /p:ExcludeByAttribute="GeneratedCodeAttribute"
+
+ publish-packages:
+ name: Publish Package to GitHub Packages and NuGet.org
+ runs-on: ubuntu-latest
+ needs: test
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+ source-url: https://nuget.pkg.github.com/bpsLogicBuilder/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # - name: NuGet login
+ # uses: NuGet/login@v1
+ # id: nuget_login
+ # with:
+ # user: ${{ secrets.NUGET_USER }}
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build project
+ run: dotnet build --no-restore --configuration Release
+
+ - name: Make script executable
+ run: chmod +x ./Release_Pack_Push.ps1
+ shell: bash
+
+ - name: Publish Packages
+ shell: pwsh
+ run: ./Release_Pack_Push.ps1
+ env:
+ REPO: ${{ github.repository }}
+ REPO_OWNER: ${{ github.repository_owner }}
+ NUGET_URL: 'https://api.nuget.org/v3/index.json'
+ GITHUB_NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # NUGET_API_KEY: ${{ steps.nuget_login.outputs.NUGET_API_KEY }}
diff --git a/CI_Pack_Push.ps1 b/CI_Pack_Push.ps1
new file mode 100644
index 0000000..78613b3
--- /dev/null
+++ b/CI_Pack_Push.ps1
@@ -0,0 +1,11 @@
+$scriptName = $MyInvocation.MyCommand.Name
+
+Write-Host "Owner ${Env:REPO_OWNER}"
+Write-Host "Repository ${Env:REPO}"
+
+if ($Env:REPO_OWNER -ne "BpsLogicBuilder") {
+ Write-Host "${scriptName}: Only create packages on BpsLogicBuilder repositories."
+} else {
+ dotnet pack --configuration Release -o ./nupkg --no-build
+ dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --api-key $Env:GITHUB_NUGET_AUTH_TOKEN
+}
\ No newline at end of file
diff --git a/LogicBuilder.Workflow.ComponentModel.Serialization.slnx b/LogicBuilder.Workflow.ComponentModel.Serialization.slnx
index 067fb25..677966b 100644
--- a/LogicBuilder.Workflow.ComponentModel.Serialization.slnx
+++ b/LogicBuilder.Workflow.ComponentModel.Serialization.slnx
@@ -2,6 +2,9 @@
+
+
+
diff --git a/Release_Pack_Push.ps1 b/Release_Pack_Push.ps1
new file mode 100644
index 0000000..d3e345a
--- /dev/null
+++ b/Release_Pack_Push.ps1
@@ -0,0 +1,12 @@
+$scriptName = $MyInvocation.MyCommand.Name
+
+Write-Host "Owner ${Env:REPO_OWNER}"
+Write-Host "Repository ${Env:REPO}"
+
+if ($Env:REPO_OWNER -ne "BpsLogicBuilder") {
+ Write-Host "${scriptName}: Only create packages on BpsLogicBuilder repositories."
+} else {
+ dotnet pack --configuration Release -o ./nupkg --no-build
+ dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --api-key $Env:GITHUB_NUGET_AUTH_TOKEN
+ # dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
+}