Skip to content

Workflow file for this run

name: Nuget package publish and release
on:
release:
types: [released]
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
jobs:
nuget:
name: 📦 Nuget - Publish package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- name: Verify commit exists in origin/master
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/master
- name: 🟣 Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: 📦 Pack
run: |
dotnet pack SpeciesDatabaseApi --configuration Release --output .
- name: 🚀 Push nuget.org
run: dotnet nuget push SpeciesDatabaseApi*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN} --skip-duplicate
publish:
name: Publish for ${{ matrix.os_identifier }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: "SpeciesDatabaseCmd_linux-x64_${{ github.ref_name }}.zip"
asset_name: "SpeciesDatabaseCmd_linux-x64_${{ github.ref_name }}"
os_identifier: linux-x64
- os: windows-latest
artifact_name: "SpeciesDatabaseCmd_win-x64_${{ github.ref_name }}.zip"
asset_name: "SpeciesDatabaseCmd_win-x64_${{ github.ref_name }}"
os_identifier: win-x64
- os: macos-latest
artifact_name: "SpeciesDatabaseCmd_osx-x64_${{ github.ref_name }}.zip"
asset_name: "SpeciesDatabaseCmd_osx-x64_${{ github.ref_name }}"
os_identifier: osx-x64
- os: macos-latest
artifact_name: "SpeciesDatabaseCmd_osx-arm64_${{ github.ref_name }}.zip"
asset_name: "SpeciesDatabaseCmd_osx-arm64_${{ github.ref_name }}"
os_identifier: osx-arm64
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- name: Verify commit exists in origin/master
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/master
- name: 🟣 Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: 🔧 Build
run: |
dotnet publish SpeciesDatabaseCmd -o ${{ matrix.asset_name }} -c Release -r ${{ matrix.os_identifier }} -p:PublishReadyToRun=true --self-contained
- name: 📦 Zip
uses: vimtor/action-zip@v1
with:
files: ${{ matrix.asset_name }}/
recursive: true
dest: ${{ matrix.artifact_name }}
- name: 🚀 Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.artifact_name }}
asset_name: ${{ matrix.artifact_name }}
tag: ${{ github.ref }}