Restore & Resolve Plugins #33
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: default | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
branches: | |
- develop | |
- main | |
workflow_dispatch: | |
env: | |
DOTNET_NOLOGO: true | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
PLUGIN_SDK_CACHE: ${{ github.workspace }}/.plugins/cache | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
cache: true | |
cache-dependency-path: ./**/packages.lock.json | |
global-json-file: global.json | |
- name: cache plugins | |
uses: actions/cache@v3 | |
with: | |
key: plugin-cache-${{ runner.os }}-${{ hashFiles('**/plugins.lock.json') }} | |
path: ${{ env.PLUGIN_SDK_CACHE }} | |
restore-keys: | | |
plugin-cache-${{ runner.os }}- | |
- name: restore sdk | |
run: dotnet restore src/LethalCompany.Plugin.Sdk.csproj --locked-mode | |
- name: build sdk | |
run: dotnet build src/LethalCompany.Plugin.Sdk.csproj --no-restore | |
- name: restore sample | |
run: dotnet restore test/LethalCompany.SdkSample.csproj --locked-mode | |
- name: build sample | |
run: dotnet build test/LethalCompany.SdkSample.csproj --no-restore | |
pack: | |
needs: [build] | |
runs-on: windows-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
cache: true | |
cache-dependency-path: ./**/packages.lock.json | |
global-json-file: global.json | |
- name: restore | |
run: dotnet restore src/LethalCompany.Plugin.Sdk.csproj --locked-mode | |
- name: pack | |
run: dotnet pack src/LethalCompany.Plugin.Sdk.csproj -c Release -o .sdk --no-restore | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lc-plugin-sdk | |
path: .sdk | |
publish: | |
if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop') | |
needs: [pack] | |
runs-on: windows-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: global.json | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: global.json | |
- name: download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: lc-plugin-sdk | |
- name: push | |
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |