Skip to content

Commit ebe4894

Browse files
committed
Merge branch 'master' into develop
2 parents ad423a3 + 80bbcb5 commit ebe4894

File tree

3 files changed

+99
-1
lines changed

3 files changed

+99
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: NuGet Push to Production - ESDM Nexus and nuget.org
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
push-nuget:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Setup .NET
12+
uses: actions/setup-dotnet@v4
13+
with:
14+
dotnet-version: 8.0.x
15+
- name: Exit if the branch is not master
16+
run: |
17+
if [[ "${{ github.ref }}" != "refs/heads/master" ]]; then
18+
echo "Branch is not master, exiting."
19+
exit 1
20+
fi
21+
- name: Setup NuGet
22+
run: dotnet nuget add source ${{ secrets.NUGET_SOURCE_URL }} -u ${{ secrets.NUGET_USERNAME }} -p ${{ secrets.NUGET_PASSWORD }} --store-password-in-clear-text --name esdm-nuget-testing
23+
- name: Restore dependencies
24+
run: dotnet restore
25+
- name: Build
26+
run: dotnet build -c Release
27+
- name: Create NuGet package
28+
run: dotnet pack -c Release
29+
- name: Auth to other Nexus repo
30+
run: dotnet nuget add source ${{ secrets.ESDM_NUGET_HOSTED_URL }} -u ${{ secrets.NUGET_USERNAME }} -p ${{ secrets.NUGET_PASSWORD }} --store-password-in-clear-text --name esdm-nuget-hosted
31+
- name: Find and Push NuGet packages to Nexus
32+
run: |
33+
PACKAGES=$(find . -name "*.nupkg" | grep -E "cloudscribe|sts\.Common")
34+
if [ -z "$PACKAGES" ]; then
35+
echo "No matching package found. Exiting."
36+
exit 1
37+
fi
38+
echo "Found packages: $PACKAGES"
39+
for PACKAGE in $PACKAGES; do
40+
echo "Pushing $PACKAGE to Nexus"
41+
dotnet nuget push "$PACKAGE" --source esdm-nuget-hosted --skip-duplicate || echo "WARNING - skipping duplicate package: $PACKAGE"
42+
done
43+
- name: Find and Push NuGet packages to nuget.org
44+
run: |
45+
PACKAGES=$(find . -name "*.nupkg" | grep -E "cloudscribe|sts\.Common")
46+
if [ -z "$PACKAGES" ]; then
47+
echo "No matching package found. Exiting."
48+
exit 1
49+
fi
50+
echo "Found packages: $PACKAGES"
51+
for PACKAGE in $PACKAGES; do
52+
echo "Pushing $PACKAGE to nuget.org"
53+
dotnet nuget push "$PACKAGE" --api-key "$NUGET_ORG_API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate || echo "WARNING - failed to upload package: $PACKAGE"
54+
done

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ You can then opt in to push notifications and under Administration > Push Notifi
1919

2020
## Build Status
2121

22-
[![cloudscribe-pwakit-develop-nuget-build](https://github.com/cloudscribe/pwakit/actions/workflows/cloudscribe-develop.yml/badge.svg?branch=develop&event=push)](https://github.com/cloudscribe/pwakit/actions/workflows/cloudscribe-develop.yml)
22+
<!-- Making badges prettier: -->
23+
[![CS Build Devel](https://img.shields.io/github/actions/workflow/status/cloudscribe/pwakit/cloudscribe-develop.yml?branch=develop&event=push&style=for-the-badge&label=🚀%20Develop%20Branch)](https://github.com/cloudscribe/pwakit/actions/workflows/cloudscribe-develop.yml)
2324

2425
## Credits
2526

update_version.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
###################
2+
## PS script to implement a semantic versioning change from (say) 8.0.x to 8.1
3+
## across all interdependent cs packages
4+
5+
## Wherever we have <Version>8.0.n</Version> replace it to <Version>8.1.0</Version> where n >= 0
6+
7+
## Wherever we have <PackageReference Include="cloudscribe.Anything" Version="8.0.*" /> replace it to <PackageReference Include="cloudscribe.Anything" Version="8.1.*" />
8+
9+
## Wherever we have <PackageReference Include="cloudscribe.Anything" Version="8.0.n" /> replace it to <PackageReference Include="cloudscribe.Anything" Version="8.1.0" /> where n >= 0
10+
11+
## Exclude cloudscribe.HtmlAgilityPack and DbHelpers because those ones are ancient and frozen
12+
###################
13+
14+
15+
# Define the directory containing the .csproj files
16+
$directory = "src"
17+
18+
# Define the new version
19+
$newVersion = "8.1.0"
20+
$newWildcardVersion = "8.1.*"
21+
22+
# Get all .csproj files in the directory and subdirectories
23+
$csprojFiles = Get-ChildItem -Path $directory -Recurse -Filter *.csproj
24+
25+
foreach ($file in $csprojFiles) {
26+
# Read the content of the .csproj file
27+
$content = Get-Content -Path $file.FullName
28+
29+
# Update the version of cloudscribe package references, except for cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers
30+
$updatedContent = $content -replace '(?<=<PackageReference Include="cloudscribe\.(?!HtmlAgilityPack|DbHelpers)[^"]+" Version=")8\.0\.\*', $newWildcardVersion
31+
$updatedContent = $updatedContent -replace '(?<=<PackageReference Include="cloudscribe\.(?!HtmlAgilityPack|DbHelpers)[^"]+" Version=")8\.0\.\d+', $newVersion
32+
33+
# Update the <Version> element if it matches the 8.0.* pattern
34+
$updatedContent = $updatedContent -replace '<Version>8\.0\.\d+</Version>', "<Version>$newVersion</Version>"
35+
36+
# Write the updated content back to the .csproj file
37+
Set-Content -Path $file.FullName -Value $updatedContent
38+
39+
Write-Host "Updated $file.FullName"
40+
}
41+
42+
Write-Host "All cloudscribe package references (except cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers) and <Version> elements have been updated to version $newVersion or $newWildcardVersion as appropriate."
43+

0 commit comments

Comments
 (0)