Add workflow for creating SettingCore nuget
authorPiotr Czaja <p.czaja@samsung.com>
Mon, 3 Jul 2023 09:47:49 +0000 (11:47 +0200)
committerPiotr Czaja/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Mon, 3 Jul 2023 11:08:12 +0000 (13:08 +0200)
.github/workflows/update_setting_core_nuget.yml [new file with mode: 0644]
build-nuget-setting-core.sh [deleted file]
workflowScripts/build-nuget-setting-core.sh [new file with mode: 0755]

diff --git a/.github/workflows/update_setting_core_nuget.yml b/.github/workflows/update_setting_core_nuget.yml
new file mode 100644 (file)
index 0000000..b5b3451
--- /dev/null
@@ -0,0 +1,37 @@
+name: Update SettingCore nuget
+on:
+  push:
+    branches:
+      - 'tizen_next'
+    paths:
+      - 'SettingCore/**.cs'
+jobs:
+  update_settingcore_nuget:
+    runs-on: [ code-default ]
+    container:
+      image: srpol-avengers-docker-local.bart.sec.samsung.net/tizen-dotnet-builder:c28c62d
+      credentials:
+        username: ${{ secrets.BART_USER}}
+        password: ${{ secrets.BART_TOKEN}}
+      options: --user root
+    steps:
+      - name: Get code
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+      - name: Build nuget
+        run: ./workflowScripts/build-nuget-setting-core.sh
+      - name: Check if nuget was successfully built
+        run: |
+          if ls artifacts/* 1> /dev/null 2>&1; then
+            NUGET_FILENAME=$(ls artifacts/)
+            echo "Nuget successfully created: $NUGET_FILENAME"
+          else
+            echo "Nuget NOT created"
+            exit 1
+          fi
+      - name: Push nuget to BART server
+        run: |
+          dotnet nuget add source https://bart.sec.samsung.net/artifactory/api/nuget/v3/srpol-avengers-nuget-local/setting \
+          -n bart -u ${{ secrets.BART_USER}} -p ${{ secrets.BART_TOKEN}} --store-password-in-clear-text
+          dotnet nuget push artifacts/$NUGET_FILENAME -s bart
diff --git a/build-nuget-setting-core.sh b/build-nuget-setting-core.sh
deleted file mode 100644 (file)
index 9b0f810..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-PROJECT=SettingCore/SettingCore.csproj
-CONFIGURATION=Debug
-OUTDIR=artifacts
-
-MAJOR=1
-MINOR=0
-PATCH=$(git rev-list --count HEAD)
-
-VERSION=$MAJOR.$MINOR.$PATCH
-
-dotnet clean $PROJECT
-rm -rf SettingCore/bin SettingCore/obj artifacts
-
-dotnet restore --force $PROJECT
-
-dotnet build --no-restore -c $CONFIGURATION $PROJECT
-
-dotnet pack --no-restore --no-build --nologo \
-    $PROJECT \
-    -o $OUTDIR \
-    -p:Version=$VERSION
-
diff --git a/workflowScripts/build-nuget-setting-core.sh b/workflowScripts/build-nuget-setting-core.sh
new file mode 100755 (executable)
index 0000000..9b0f810
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+PROJECT=SettingCore/SettingCore.csproj
+CONFIGURATION=Debug
+OUTDIR=artifacts
+
+MAJOR=1
+MINOR=0
+PATCH=$(git rev-list --count HEAD)
+
+VERSION=$MAJOR.$MINOR.$PATCH
+
+dotnet clean $PROJECT
+rm -rf SettingCore/bin SettingCore/obj artifacts
+
+dotnet restore --force $PROJECT
+
+dotnet build --no-restore -c $CONFIGURATION $PROJECT
+
+dotnet pack --no-restore --no-build --nologo \
+    $PROJECT \
+    -o $OUTDIR \
+    -p:Version=$VERSION
+