From 9c79939a0bad9b5a3beb914449cefd9bada9c958 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Mon, 22 Apr 2024 12:19:06 +0300 Subject: [PATCH] upd - Added the push scripts and used them --- .github/workflows/pack.yml | 25 +++++++++++++------------ tools/push.cmd | 13 +++++++++++++ tools/push.sh | 25 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 tools/push.cmd create mode 100644 tools/push.sh diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index fa15fe6..c0a510b 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -10,15 +10,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: make - - name: Package Publication - run: dotnet nuget push "VisualCard/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_APIKEY }} --source "nuget.org" - + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Solution Compilation + run: make + - name: Package Publication + run: | + chmod +x tools/*.sh + cd tools ; NUGET_APIKEY=${{ secrets.NUGET_APIKEY }} ./push.sh ; cd .. diff --git a/tools/push.cmd b/tools/push.cmd new file mode 100644 index 0000000..45b5bcd --- /dev/null +++ b/tools/push.cmd @@ -0,0 +1,13 @@ +@echo off +set apikey=%1 + +REM This script pushes. Use when you have VS installed. +echo Pushing... +cmd /C "forfiles /s /m *.nupkg /p ..\ /C "cmd /c dotnet nuget push @path --api-key %apikey% --source "nuget.org""" +if %errorlevel% == 0 goto :success +echo There was an error trying to push (%errorlevel%). +goto :finished + +:success +echo Push successful. +:finished diff --git a/tools/push.sh b/tools/push.sh new file mode 100644 index 0000000..bb1e504 --- /dev/null +++ b/tools/push.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# This script pushes. Use when you have dotnet installed. +releaseconf=$1 +if [ -z $releaseconf ]; then + releaseconf=Release +fi + +# Check for dependencies +dotnetpath=`which dotnet` +if [ ! $? == 0 ]; then + echo dotnet is not found. + exit 1 +fi + +# Push packages +echo Pushing packages... +find .. -type f -path "*/bin/$releaseconf/*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "nuget.org" \; +if [ ! $? == 0 ]; then + echo Push failed. + exit 1 +fi + +# Inform success +echo Push successful. +exit 0