diff --git a/.github/workflows/nuget-package-push.yml b/.github/workflows/nuget-package-push.yml index 4ef5d878f5..18ac0e30ef 100644 --- a/.github/workflows/nuget-package-push.yml +++ b/.github/workflows/nuget-package-push.yml @@ -20,12 +20,6 @@ name: Push Nuget Packages and Tag on: - push: - paths: - - 'src/framework/**' - branches: - - 'dev' - - 'release/v*.*.*-RC*' workflow_dispatch: jobs: @@ -44,15 +38,28 @@ jobs: dotnet-version: ${{ matrix.dotnet-version }} - name: Install dependencies - run: dotnet restore src/framework + run: dotnet restore src - name: Build - run: dotnet build src/framework --configuration Release --no-restore + run: dotnet build src --configuration Release --no-restore + + - name: Check Package Suffix Versions + shell: bash + run: | + script_output=$(./scripts/no_suffix_check.sh) + + if [ -z "$script_output" ]; then + echo "No version suffixes set" + else + echo "the following packages have a suffix version set, please remove them:" + echo "$script_output" + exit 1 + fi - name: Push nuget packages shell: bash run: | - bash ./scripts/pack_and_push_packages.sh ${{ secrets.NUGET_API_KEY }} + bash ./scripts/pack_and_push_packages.sh --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - name: Get new version id: nugetPackageVersion diff --git a/scripts/no_suffix_version_check.sh b/scripts/no_suffix_version_check.sh new file mode 100755 index 0000000000..e04c1903dd --- /dev/null +++ b/scripts/no_suffix_version_check.sh @@ -0,0 +1,29 @@ +############################################################### +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### + +#!/bin/bash + +for dir in ./src/framework/*/; do + if [ -d "$dir" ]; then + local props_file=$dir"Directory.Build.props" + if ! grep -qE "<\/VersionSuffix>" $props_file; then + echo $dir + fi + fi +done diff --git a/scripts/pack_and_push_packages.sh b/scripts/pack_and_push_packages.sh index 5416fa52a7..450f816a6e 100755 --- a/scripts/pack_and_push_packages.sh +++ b/scripts/pack_and_push_packages.sh @@ -19,14 +19,6 @@ #!/bin/bash -# Check if the correct number of arguments are provided -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " - exit 1 -fi - -# Assign the arguments to variables -NUGET_API_KEY="$1" folderPath="./packages" # Function to iterate over directories in the Framework directory and create a nuget package @@ -43,7 +35,7 @@ iterate_directories() { iterate_directories for packageFile in "$folderPath"/*.nupkg; do - dotnet nuget push "$packageFile" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push "$packageFile" "$@" done rm -r "$folderPath" diff --git a/scripts/pack_and_push_packages_local.sh b/scripts/pack_and_push_packages_local.sh index e393484fd9..358c27d65c 100755 --- a/scripts/pack_and_push_packages_local.sh +++ b/scripts/pack_and_push_packages_local.sh @@ -19,23 +19,4 @@ #!/bin/bash -folderPath="./packages" - -# Function to iterate over directories in the Framework directory and create a nuget package -iterate_directories() { - for dir in ./src/framework/*/; do - if [ -d "$dir" ]; then - proj="$(basename "$dir")" - echo "Pack project: $proj" - dotnet pack src/framework/$proj/$proj.csproj -c Release -o "$folderPath" - fi - done -} - -iterate_directories - -for packageFile in "$folderPath"/*.nupkg; do - dotnet nuget push "$packageFile" --source "local" --skip-duplicate -done - -rm -r "$folderPath" +. ./scripts/pack_and_push_packages.sh --source "local" --skip-duplicate