Skip to content

Commit 1bf26e0

Browse files
committed
Improve MCPP release workflow
1 parent 0264ec0 commit 1bf26e0

23 files changed

Lines changed: 325 additions & 246 deletions
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: "Build NuGet Packages"
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
build:
9+
name: "Build NuGet Package (${{ matrix.package }})"
10+
runs-on: windows-2022
11+
strategy:
12+
matrix:
13+
include:
14+
- package: v142
15+
toolset: v142
16+
17+
- package: v143
18+
toolset: v143
19+
20+
- package: ZeroC.Mcpp
21+
toolset: v143
22+
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
27+
- name: Setup MSBuild
28+
uses: microsoft/setup-msbuild@v2
29+
30+
- name: Install MSVC v142 toolset
31+
if: matrix.toolset == 'v142'
32+
shell: pwsh
33+
run: |
34+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
35+
$vsInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe"
36+
37+
$installPath = & $vswhere -latest -products * -property installationPath
38+
if (-not $installPath) { throw "Visual Studio installation not found." }
39+
40+
# v142 toolset component group ID (VS2019 toolset)
41+
& $vsInstaller modify --installPath "$installPath" `
42+
--add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 `
43+
--quiet --wait --norestart
44+
45+
- name: Build NuGet Package
46+
working-directory: msbuild
47+
run: MSBuild mcpp.proj /t:NugetPack /p:DefaultPlatformToolset=${{ matrix.toolset }}
48+
49+
- name: Rename package directory for ZeroC.Mcpp
50+
if: matrix.package == 'ZeroC.Mcpp'
51+
working-directory: msbuild
52+
run: |
53+
Remove-Item -Path "ZeroC.Mcpp" -Recurse -Force -ErrorAction SilentlyContinue
54+
Rename-Item -Path "mcpp.v143" -NewName "ZeroC.Mcpp"
55+
Copy-Item -Path "README.ZeroC.Mcpp.md" -Destination "ZeroC.Mcpp\README.md" -Force
56+
Copy-Item -Path "ZeroC.Mcpp.nuspec" -Destination "ZeroC.Mcpp\" -Force
57+
Copy-Item -Path "ZeroC.Mcpp.targets" -Destination "ZeroC.Mcpp\build\native\" -Force
58+
nuget pack ZeroC.Mcpp\ZeroC.Mcpp.nuspec -NoPackageAnalysis -NonInteractive -OutputDirectory ZeroC.Mcpp
59+
60+
- name: Upload Artifacts
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: nuget-package-${{ matrix.package }}
64+
path: |
65+
msbuild/${{ matrix.package == 'ZeroC.Mcpp' && 'ZeroC.Mcpp' || format('mcpp.{0}', matrix.toolset) }}/*.nupkg
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mcpp_version:
7+
required: false
8+
type: string
9+
channel:
10+
required: true
11+
type: string
12+
quality:
13+
required: true
14+
type: string
15+
publish:
16+
required: false
17+
type: boolean
18+
default: false
19+
20+
workflow_dispatch:
21+
inputs:
22+
mcpp_version:
23+
description: "The MCPP version to build (leave empty for stable)"
24+
required: false
25+
channel:
26+
description: "The release channel (e.g., 2.7, 3.7)"
27+
required: true
28+
quality:
29+
description: "Release quality (e.g., stable, nightly, RC)"
30+
required: true
31+
default: "nightly"
32+
publish:
33+
description: "Whether to publish the packages"
34+
required: false
35+
default: false
36+
type: boolean
37+
38+
jobs:
39+
build-nuget-packages:
40+
name: Build NuGet Packages
41+
uses: ./.github/workflows/build-nuget-packages.yml
42+
secrets: inherit
43+
44+
build-rpm-packages:
45+
name: Build RPM Packages
46+
uses: ./.github/workflows/build-rpm-packages.yml
47+
with:
48+
channel: ${{ inputs.channel }}
49+
secrets: inherit
50+
51+
publish-release:
52+
name: Publish Release
53+
if: ${{ inputs.publish == true }}
54+
needs:
55+
- build-nuget-packages
56+
- build-rpm-packages
57+
uses: ./.github/workflows/publish-release.yml
58+
with:
59+
channel: ${{ inputs.channel }}
60+
quality: ${{ inputs.quality }}
61+
run_id: ${{ github.run_id }}
62+
secrets: inherit
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
name: "Build RPM Packages"
22

33
on:
4-
push:
5-
# Run on version tags
6-
tags:
7-
- "v[0-9]*"
84
workflow_dispatch:
95
inputs:
106
mcpp_version:
117
description: "The MCPP version to build"
128
required: false
9+
channel:
10+
description: "The release channel (e.g., 3.7, 3.8)"
11+
required: true
12+
workflow_call:
13+
inputs:
14+
mcpp_version:
15+
required: false
16+
type: string
17+
channel:
18+
required: true
19+
type: string
1320

1421
jobs:
1522
build:
@@ -56,10 +63,13 @@ jobs:
5663
run: |
5764
docker run --rm \
5865
-v "$GITHUB_WORKSPACE:/workspace" \
59-
-e GPG_KEY="${{ secrets.ICE_3_8_CI_SIGNER_KEY }}" \
60-
-e GPG_KEY_ID="${{ secrets.ICE_3_8_CI_SIGNER_KEY_ID }}" \
66+
-e GPG_KEY="${GPG_KEY}" \
67+
-e GPG_KEY_ID="${GPG_KEY_ID}" \
6168
ghcr.io/zeroc-ice/rpm-repo-builder:latest \
6269
/usr/local/bin/rpm-sign /workspace/build/RPMS
70+
env:
71+
GPG_KEY: ${{ inputs.channel == '3.7' && secrets.ICE_3_7_CI_SIGNER_KEY || secrets.ICE_3_8_CI_SIGNER_KEY }}
72+
GPG_KEY_ID: ${{ inputs.channel == '3.7' && secrets.ICE_3_7_CI_SIGNER_KEY_ID || secrets.ICE_3_8_CI_SIGNER_KEY_ID }}
6373

6474
- name: Upload Artifacts
6575
uses: actions/upload-artifact@v4
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "Publish NuGet Packages"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
channel:
7+
description: "The release channel (e.g., 3.7, 3.8)"
8+
required: true
9+
quality:
10+
description: "Release quality (e.g., stable, nightly, RC)"
11+
required: true
12+
default: "nightly"
13+
run_id:
14+
description: "The run ID to use for downloading artifacts"
15+
required: true
16+
workflow_call:
17+
inputs:
18+
channel:
19+
required: true
20+
type: string
21+
quality:
22+
required: true
23+
type: string
24+
run_id:
25+
required: true
26+
type: string
27+
28+
jobs:
29+
publish:
30+
name: "Publish NuGet Packages"
31+
runs-on: ubuntu-24.04
32+
steps:
33+
- name: Download NuGet artifacts
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
gh run download "${{ inputs.run_id }}" --repo ${{ github.repository }} --pattern "nuget-package-*" --dir staging
38+
39+
- name: Publish NuGet Packages
40+
run: |
41+
case "$QUALITY" in
42+
"stable")
43+
SOURCE_URL="https://api.nuget.org/v3/index.json"
44+
NUGET_API_KEY="${RELEASE_NUGET_API_KEY}"
45+
;;
46+
*)
47+
SOURCE_URL="https://download.zeroc.com/nexus/repository/nuget-${CHANNEL}-${QUALITY}/"
48+
NUGET_API_KEY="${NEXUS_NIGHTLY_NUGET_API_KEY}"
49+
;;
50+
esac
51+
52+
# Collect all packages
53+
mapfile -t packages < <(find staging -type f -name "*.nupkg")
54+
55+
# Push each package to the appropriate NuGet repository
56+
for package in "${packages[@]}"; do
57+
echo "Publishing package: $package"
58+
dotnet nuget push "$package" --source "$SOURCE_URL" --api-key "$NUGET_API_KEY"
59+
done
60+
env:
61+
CHANNEL: ${{ inputs.channel }}
62+
QUALITY: ${{ inputs.quality }}
63+
NEXUS_NIGHTLY_NUGET_API_KEY: ${{ secrets.NEXUS_NIGHTLY_NUGET_API_KEY }}
64+
RELEASE_NUGET_API_KEY: ${{ secrets.RELEASE_NUGET_API_KEY }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Publish MCPP Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
channel:
7+
description: "The release channel (e.g., 2.7, 2.8)"
8+
required: true
9+
quality:
10+
description: "Release quality (e.g., stable, nightly, RC)"
11+
required: true
12+
default: "nightly"
13+
run_id:
14+
description: "The GitHub run ID to use for artifacts"
15+
required: true
16+
17+
workflow_call:
18+
inputs:
19+
channel:
20+
required: true
21+
type: string
22+
quality:
23+
required: true
24+
type: string
25+
run_id:
26+
required: true
27+
type: string
28+
29+
jobs:
30+
publish-nuget-packages:
31+
uses: ./.github/workflows/publish-nuget-packages.yml
32+
with:
33+
channel: ${{ inputs.channel }}
34+
quality: ${{ inputs.quality }}
35+
run_id: ${{ inputs.run_id }}
36+
secrets: inherit
37+
38+
publish-rpm-packages:
39+
uses: ./.github/workflows/publish-rpm-packages.yml
40+
with:
41+
channel: ${{ inputs.channel }}
42+
quality: ${{ inputs.quality }}
43+
run_id: ${{ inputs.run_id }}
44+
secrets: inherit
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "Publish RPM Packages"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
channel:
7+
description: "The release channel (e.g., 3.7, 3.8)"
8+
required: true
9+
quality:
10+
description: "Release quality (e.g., stable, nightly, RC)"
11+
required: true
12+
default: "nightly"
13+
run_id:
14+
description: "The run ID to use for downloading artifacts"
15+
required: true
16+
workflow_call:
17+
inputs:
18+
channel:
19+
required: true
20+
type: string
21+
quality:
22+
required: true
23+
type: string
24+
run_id:
25+
required: true
26+
type: string
27+
28+
jobs:
29+
publish:
30+
name: "Publish RPM Packages"
31+
runs-on: ubuntu-24.04
32+
steps:
33+
- name: Download RPM artifacts
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
gh run download "${{ inputs.run_id }}" --repo ${{ github.repository }} --pattern "rpm-packages-*" --dir staging
38+
39+
- name: Upload to S3 Repository
40+
run: |
41+
if [ "${QUALITY}" = "stable" ]; then
42+
UPLOAD_PATH="mcpp/${CHANNEL}"
43+
else
44+
UPLOAD_PATH="mcpp/${QUALITY}/${CHANNEL}"
45+
fi
46+
47+
echo "Uploading RPM packages to S3..."
48+
for dir in staging/rpm-packages-*; do
49+
if [ -d "$dir" ]; then
50+
artifact_name=$(basename "$dir")
51+
echo "Uploading $artifact_name..."
52+
pushd "$dir" > /dev/null
53+
zip -r "../${artifact_name}.zip" .
54+
popd > /dev/null
55+
aws s3 cp "staging/${artifact_name}.zip" "s3://zeroc-downloads/${UPLOAD_PATH}/"
56+
fi
57+
done
58+
env:
59+
CHANNEL: ${{ inputs.channel }}
60+
QUALITY: ${{ inputs.quality }}
61+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
62+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# MCPP.V140
1+
# ZeroC.Mcpp
22

3-
This package contains debug and release builds of the mcpp 2.7.2 static library. It was built with Visual Studio 2015 (V140).
3+
This package contains debug and release builds of the mcpp 2.7.4 static library. It was built with Visual Studio 2022 and supports both v142 and v143 platform toolsets.
44

55
## Source
66

msbuild/README.v100.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

msbuild/README.v110.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

msbuild/README.v120.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)