Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download NuGet artifacts from another reposity to get latest version when requested #533

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
push:
# only trigger on branches, not on tags
branches: '**'
workflow_dispatch:
inputs:
UseLastRepositoryBuild:
description: 'Use latest NuGet packages from JNet'
required: true
default: false
type: boolean

# This workflow contains two jobs called "check_changes", "build_windows"
jobs:
Expand Down Expand Up @@ -75,6 +82,26 @@ jobs:
fetch-depth: '1'
submodules: 'true'

- name: Get last workflow run of JNet
if: ${{ inputs.UseLastRepositoryBuild == true }}
shell: bash
run: echo "JNET_LAST_RUN=$(curl -sL https://api.github.com/repos/masesgroup/JNet/actions/workflows/build.yaml/runs | jq -r '.workflow_runs[0].id?')" >> $GITHUB_ENV

- name: Download artifact
if: ${{ inputs.UseLastRepositoryBuild == true }}
run: gh run download ${{ env.JNET_LAST_RUN }} --name JNetNuGet --repo masesgroup/JNet --dir JNetNuGet
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: List NuGet packages downloaded
continue-on-error: true
shell: cmd
run: dir .\JNetNuGet\*nupkg

- name: Add local repo
if: ${{ success() && inputs.UseLastRepositoryBuild == true }}
run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\"

- name: Pre compile
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\KNet\KNet.csproj
env:
Expand Down Expand Up @@ -123,7 +150,7 @@ jobs:
Copy-Item .\src\net\KNetPS\MASES.KNetPS.psd1 -Destination .\MASES.KNetPS\MASES.KNetPS.psd1 -Force
Copy-Item .\src\net\KNetPS\MASES.KNetPS.psm1 -Destination .\MASES.KNetPS\MASES.KNetPS.psm1 -Force
shell: pwsh

- name: Create PowerShell package
run: |
$env:DOTNET_CLI_UI_LANGUAGE="en_US"
Expand All @@ -137,7 +164,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: KNet
name: KNetNuGet
path: .\bin\*nupkg

- name: Compile tests
Expand Down