gha: Add steps to upload nupkg as artifact & publish to Nuget

This commit is contained in:
TSR Berry
2023-01-29 00:47:46 +01:00
parent 81baee2b1c
commit cee8e6b5da

View File

@@ -124,7 +124,7 @@ jobs:
- name: '📤 Upload artifact' - name: '📤 Upload artifact'
if: always() if: always()
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v2
with: with:
path: ./${{ matrix.config.artifact }} path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }} name: ${{ matrix.config.artifact }}
@@ -182,7 +182,7 @@ jobs:
- name: '📤 Upload artifact' - name: '📤 Upload artifact'
if: always() if: always()
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v2
with: with:
path: ./${{ matrix.config.artifact }} path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }} name: ${{ matrix.config.artifact }}
@@ -307,7 +307,7 @@ jobs:
- name: '📤 Upload artifact' - name: '📤 Upload artifact'
if: always() if: always()
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v2
with: with:
path: ./${{ matrix.config.artifact }} path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }} name: ${{ matrix.config.artifact }}
@@ -320,12 +320,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Download artifacts - name: 🛠️ Download artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
path: artifacts path: artifacts
- name: Extract artifacts - name: 🛠️ Extract artifacts
shell: python shell: python
run: | run: |
import subprocess import subprocess
@@ -397,7 +397,7 @@ jobs:
print("Done!") print("Done!")
- name: Get short sha - name: 🛠️ Get short sha
id: git_short_sha id: git_short_sha
run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
@@ -405,21 +405,32 @@ jobs:
with: with:
dotnet-version: 6.0.x dotnet-version: 6.0.x
- name: Authenticate to Github Packages - name: 🛠️ Authenticate to Github Packages
working-directory: bindings/dotnet/UnicornEngine working-directory: bindings/dotnet/UnicornEngine
run: dotnet nuget add source --username "${{ github.repository_owner }}" --password "${{ secrets.GITHUB_TOKEN }}" --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" run: dotnet nuget add source --username "${{ github.repository_owner }}" --password "${{ secrets.GITHUB_TOKEN }}" --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
- name: List all native libraries - name: 🛠️ List all native libraries
working-directory: bindings/dotnet/UnicornEngine working-directory: bindings/dotnet/UnicornEngine
run: find ./runtimes -type f -print run: find ./runtimes -type f -print
- name: Package .NET distribution - name: 🚧 Package .NET distribution
working-directory: bindings/dotnet/UnicornEngine working-directory: bindings/dotnet/UnicornEngine
run: | run: |
[[ "${{ github.ref_name }}" == "master" ]] \ [[ "${{ github.ref_name }}" == "master" ]] \
&& dotnet pack -c Release \ && dotnet pack -c Release \
|| dotnet pack -c Release --version-suffix="${{ steps.git_short_sha.outputs.result }}" || dotnet pack -c Release --version-suffix="${{ steps.git_short_sha.outputs.result }}"
- name: '📤 Upload artifact'
uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/bindings/dotnet/UnicornEngine/bin/Release/UnicornEngine.Unicorn.*.nupkg
- name: 📦 Publish to Github Packages - name: 📦 Publish to Github Packages
working-directory: bindings/dotnet/UnicornEngine working-directory: bindings/dotnet/UnicornEngine
run: dotnet nuget push "bin/Release/UnicornEngine.Unicorn.*.nupkg" --source "github" --api-key "${{ secrets.GHPR_TOKEN }}" run: dotnet nuget push "bin/Release/UnicornEngine.Unicorn.*.nupkg" --source "github" --api-key "${{ secrets.GHPR_TOKEN }}"
- name: 📦 Publish Nuget package
working-directory: bindings/dotnet/UnicornEngine
run: dotnet nuget push "bin/Release/UnicornEngine.Unicorn.*.nupkg" -k "$NUGET_AUTH_TOKEN" -s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_KEY }}