From 809a202537a1a3af9561888245ea34c6404307c0 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 00:52:19 +0200 Subject: [PATCH 1/9] Download NuGet artifacts from another to get always latest version --- .github/workflows/build.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c5acf952d6..499d567ecd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,6 +75,20 @@ jobs: fetch-depth: '1' submodules: 'true' + - uses: actions/download-artifact@v4 + with: + name: JNet + github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo + repository: masesgroup/JNet + path: ./JNetNuGet + + - name: List NuGet packages downloaded + shell: cmd + run: dir .\JNetNuGet\*nupkg + + - name: Add local repo + 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: From 3d16c9df1e64b1ee511b3631cf9a8217c41769ce Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 00:55:26 +0200 Subject: [PATCH 2/9] Trigger --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 499d567ecd..819fba1d27 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -137,7 +137,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" From 2ff11508591aeac4301821d30aaa6a43b6e3d59f Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 01:15:09 +0200 Subject: [PATCH 3/9] Test --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 819fba1d27..f59345578f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -76,8 +76,9 @@ jobs: submodules: 'true' - uses: actions/download-artifact@v4 + continue-on-error: true with: - name: JNet + name: JNetNuGet github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo repository: masesgroup/JNet path: ./JNetNuGet From 5deb99ca92e5d42a5a294329c5acd910c764fbee Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 01:40:26 +0200 Subject: [PATCH 4/9] test run-id --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f59345578f..f87253f608 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -82,6 +82,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo repository: masesgroup/JNet path: ./JNetNuGet + run-id: 366 - name: List NuGet packages downloaded shell: cmd From fb84fbcf98523f7814aaa500e661f120b6a7cf1f Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:06:08 +0200 Subject: [PATCH 5/9] Up --- .github/workflows/build.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f87253f608..f2dbd14681 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,20 +75,29 @@ jobs: fetch-depth: '1' submodules: 'true' + - name: Get last workflow run of JNet + shell: bash + run: echo "JNET_LAST_RUN=$(curl -sL https://api.github.com/repos/masesgroup/JNet/actions/workflows/build.yml/runs | jq -r '.workflow_runs[0].id?')" >> $GITHUB_ENV + - uses: actions/download-artifact@v4 continue-on-error: true + # run: gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/masesgroup/JNet/actions/artifacts/ARTIFACT_ID with: name: JNetNuGet github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo repository: masesgroup/JNet path: ./JNetNuGet - run-id: 366 + run-id: ${{ env.JNET_LAST_RUN }} + 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 + continue-on-error: true run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\" - name: Pre compile From e5fd104fd1df3f38a7cff4a415a5f97cbb68562a Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:29:41 +0200 Subject: [PATCH 6/9] fix --- .github/workflows/build.yaml | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f2dbd14681..b8222ff5b4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,19 +77,33 @@ jobs: - name: Get last workflow run of JNet shell: bash - run: echo "JNET_LAST_RUN=$(curl -sL https://api.github.com/repos/masesgroup/JNet/actions/workflows/build.yml/runs | jq -r '.workflow_runs[0].id?')" >> $GITHUB_ENV + 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 - - uses: actions/download-artifact@v4 - continue-on-error: true - # run: gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/masesgroup/JNet/actions/artifacts/ARTIFACT_ID - with: - name: JNetNuGet - github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo - repository: masesgroup/JNet - path: ./JNetNuGet - run-id: ${{ env.JNET_LAST_RUN }} + - name: Download artifact + run: gh run download ${{ env.JNET_LAST_RUN }} --name JNetNuGet --repo masesgroup/JNet env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: List packages downloaded + shell: cmd + run: dir .\ + + - name: Unzip packages downloaded + run: 7z x JNetNuGet.zip + + # - uses: actions/download-artifact@v4 + # continue-on-error: true + # # run: gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/masesgroup/JNet/actions/artifacts/ARTIFACT_ID + # with: + # name: JNetNuGet + # github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo + # repository: masesgroup/JNet + # path: ./JNetNuGet + # run-id: ${{ env.JNET_LAST_RUN }} + + - name: List packages downloaded + shell: cmd + run: dir .\ - name: List NuGet packages downloaded continue-on-error: true @@ -97,7 +111,7 @@ jobs: run: dir .\JNetNuGet\*nupkg - name: Add local repo - continue-on-error: true + if: succeded() run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\" - name: Pre compile From 5b64435c56eb074821efbeda9ae6449bddbff49b Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:31:52 +0200 Subject: [PATCH 7/9] fix --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b8222ff5b4..31c3232f37 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -111,7 +111,7 @@ jobs: run: dir .\JNetNuGet\*nupkg - name: Add local repo - if: succeded() + if: success() run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\" - name: Pre compile From 98699fdf8464e67a3c415356e40a975cfdf3d9af Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:35:34 +0200 Subject: [PATCH 8/9] Update --- .github/workflows/build.yaml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 31c3232f37..bb9183b34a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -80,30 +80,9 @@ jobs: 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 - run: gh run download ${{ env.JNET_LAST_RUN }} --name JNetNuGet --repo masesgroup/JNet + run: gh run download ${{ env.JNET_LAST_RUN }} --name JNetNuGet --repo masesgroup/JNet --dir JNetNuGet env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: List packages downloaded - shell: cmd - run: dir .\ - - - name: Unzip packages downloaded - run: 7z x JNetNuGet.zip - - # - uses: actions/download-artifact@v4 - # continue-on-error: true - # # run: gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/masesgroup/JNet/actions/artifacts/ARTIFACT_ID - # with: - # name: JNetNuGet - # github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo - # repository: masesgroup/JNet - # path: ./JNetNuGet - # run-id: ${{ env.JNET_LAST_RUN }} - - - name: List packages downloaded - shell: cmd - run: dir .\ - name: List NuGet packages downloaded continue-on-error: true From d0c06b2a35307e462654b45db8d7c4deaf7d32bd Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 3 Jul 2024 03:21:32 +0200 Subject: [PATCH 9/9] By default use last official version, on user request use last builds --- .github/workflows/build.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bb9183b34a..c92abb3eb4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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: @@ -76,10 +83,12 @@ jobs: 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 }} @@ -90,7 +99,7 @@ jobs: run: dir .\JNetNuGet\*nupkg - name: Add local repo - if: success() + if: ${{ success() && inputs.UseLastRepositoryBuild == true }} run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\" - name: Pre compile @@ -155,7 +164,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: KNet + name: KNetNuGet path: .\bin\*nupkg - name: Compile tests