vpenades hai 1 ano
pai
achega
5f07bc00a3

+ 8 - 7
.github/workflows/BuildPackages.yml

@@ -29,21 +29,22 @@ jobs:
     - name: define version suffix
       run: |
           if [ -z "${{ env.VERSIONSUFFIX }}" ]; then
-          echo "VERSIONSUFFIX=alpha${{ vars.SharpGLTF_AlphaVersion }}" >> $GITHUB_ENV
-          echo "VERSIONSUFFIX is set to ${{ env.VERSIONSUFFIX }}"
+          echo "VERSIONSUFFIX=${{ inputs.version-suffix }}" >> $GITHUB_ENV
+          fi
+          if [ -z "${{ env.VERSIONSUFFIX }}" ]; then
+          echo "VERSIONSUFFIX=Test-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV          
           fi
+          echo "VERSIONSUFFIX is set to ${{ env.VERSIONSUFFIX }}"
 
       # ---------------------------------------------  build
 
     - name: Build
       run: dotnet build -c Release --version-suffix ${{ env.VERSIONSUFFIX }}
     
-    - name: Pack nugets
-      run: dotnet pack -c Release --no-build --output .
-
-      # ---------------------------------------------  publish    
+    - name: Pack
+      run: dotnet pack -c Release --no-build --output "."
 
-    - name: Archive nuget packages
+    - name: Archive
       uses: actions/upload-artifact@v4
       with:
         name: nuget-packages

+ 24 - 0
.github/workflows/PublishToGithub.yml

@@ -0,0 +1,24 @@
+name: Publish artifacts to Github
+
+on: workflow_dispatch
+    
+jobs:
+
+  build_job:
+    uses: ./.github/workflows/BuildPackages.yml
+    with:
+      version-suffix: Preview-$(date +'%Y%m%d-%H%M%S')"
+
+  publish_job:
+    needs: build_job
+    runs-on: ubuntu-latest
+
+    steps:
+
+    - name: Download all artifacts
+      uses: actions/download-artifact@v4
+      with:
+        name: nuget-packages
+
+    - name: Push to NuGet
+      run: dotnet nuget push "*.nupkg" --api-key ${{secrets.SharpGLTF_PublishToGithub}} --source https://nuget.pkg.github.com/${{github.repository_owner}}

+ 17 - 18
.github/workflows/PublishToNuget.yml

@@ -1,25 +1,24 @@
-name: Build a preview and release it to Nuget
+name: Publish artifacts to Nuget
 
 on: workflow_dispatch
     
 jobs:
-  build:
-    runs-on: ubuntu-latest    
-    timeout-minutes: 5
+
+  build_job:
+    uses: ./.github/workflows/BuildPackages.yml
+    with:
+      version-suffix: alpha${{ vars.SharpGLTF_AlphaVersion }}
+
+  publish_job:
+    needs: build_job
+    runs-on: ubuntu-latest
+
     steps:
-    - name: define version suffix      
-      run: echo "VERSIONSUFFIX=alpha${{ vars.SharpGLTF_AlphaVersion }}" >> $GITHUB_ENV
-    - name: Checkout
-      uses: actions/checkout@v4
-    - name: Setup .NET SDK
-      uses: actions/setup-dotnet@v4  
-    - name: Install dependencies
-      run: dotnet restore
-    - name: Build
-      run: dotnet build -c Release --version-suffix ${{ env.VERSIONSUFFIX }}
-#    - name: Test
-#      run: dotnet test -c Release --no-build
-    - name: Pack nugets
-      run: dotnet pack -c Release --no-build --output .
+
+    - name: Download all artifacts
+      uses: actions/download-artifact@v4
+      with:
+        name: nuget-packages
+
     - name: Push to NuGet
       run: dotnet nuget push "*.nupkg" --api-key ${{secrets.SharpGLTF_PublishToNuget}} --source https://api.nuget.org/v3/index.json