From f54e377a8b4675f692c1c32e62c84599f56e447c Mon Sep 17 00:00:00 2001 From: Andrzej Fiedukowicz Date: Fri, 19 Jan 2024 17:25:39 +0100 Subject: [PATCH] Extract file --- .../workflows/bcny-build-nuget-package.yml | 151 ++++++++++++++++ .github/workflows/bcny-validate.yml | 164 ++++-------------- 2 files changed, 188 insertions(+), 127 deletions(-) create mode 100644 .github/workflows/bcny-build-nuget-package.yml diff --git a/.github/workflows/bcny-build-nuget-package.yml b/.github/workflows/bcny-build-nuget-package.yml new file mode 100644 index 0000000000..8af4f38b0b --- /dev/null +++ b/.github/workflows/bcny-build-nuget-package.yml @@ -0,0 +1,151 @@ +name: "bcny-build-nuget-package" +on: + workflow_call: + inputs: + arch: + description: "Name of the architecture amd64 or arm64" + required: true + type: string + platform: + description: "MSVC understandable platform name x64 or ARM64" + required: true + type: string + +jobs: + windows: + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + include: + - arch: 'amd64' + platform: 'x64' + - arch: 'arm64' + platform: 'ARM64' + + steps: + - uses: actions/checkout@v4 + + - uses: compnerd/gha-setup-vsdevenv@main + with: + host_arch: amd64 + components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' + arch: ${{ inputs.arch }} + + - uses: actions/setup-python@v4 + id: python + with: + python-version: 3.9 + architecture: 'x64' + + - name: Build StaticRelease + run: + msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=StaticRelease /p:Platform=${{ inputs.platform }} + + - name: Build DynRelease + run: + msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=DynRelease /p:Platform=${{ inputs.platform }} + + - name: Build LtcgRelease + run: + msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=LtcgRelease /p:Platform=${{ inputs.platform }} + + - name: Package libsodium + run: | + @" + + + + org.libsodium.libsodium.windows.${{ inputs.arch }} + 0.0.0 + libsodium + libsodium + org.libsodium + https://libsodium.org + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "@ | Out-File -Encoding UTF8 libsodium.nuspec + nuget pack -Suffix (git log -1 --format=%h) libsodium.nuspec + shell: pwsh + + - uses: actions/upload-artifact@v3 + with: + name: windows-${{ inputs.arch }}.nupkg + path: org.libsodium.libsodium.windows.${{ inputs.arch }}.*.nupkg diff --git a/.github/workflows/bcny-validate.yml b/.github/workflows/bcny-validate.yml index ecdfe1ef3a..6723411b04 100644 --- a/.github/workflows/bcny-validate.yml +++ b/.github/workflows/bcny-validate.yml @@ -1,14 +1,15 @@ name: Validate nuget package on: + workflow_dispatch: pull_request: branches: - master jobs: - windows: + build_nuget_package: + name: "Build nuget package" runs-on: windows-latest - strategy: fail-fast: false matrix: @@ -18,128 +19,37 @@ jobs: - arch: 'arm64' platform: 'ARM64' - steps: - - uses: actions/checkout@v4 - - - uses: compnerd/gha-setup-vsdevenv@main - with: - host_arch: amd64 - components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' - arch: ${{ matrix.arch }} - - - uses: actions/setup-python@v4 - id: python - with: - python-version: 3.9 - architecture: 'x64' - - - name: Build StaticRelease - run: - msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=StaticRelease /p:Platform=${{ matrix.platform }} - - - name: Build DynRelease - run: - msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=DynRelease /p:Platform=${{ matrix.platform }} - - - name: Build LtcgRelease - run: - msbuild .\builds\msvc\vs2022\libsodium.sln /p:Configuration=LtcgRelease /p:Platform=${{ matrix.platform }} - - - name: Package libsodium - run: | - @" - - - - org.libsodium.libsodium.windows.${{ matrix.arch }} - 0.0.0 - libsodium - libsodium - org.libsodium - https://libsodium.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "@ | Out-File -Encoding UTF8 libsodium.nuspec - nuget pack -Suffix (git log -1 --format=%h) libsodium.nuspec - shell: pwsh - - - uses: actions/upload-artifact@v3 - with: - name: windows-${{ matrix.arch }}.nupkg - path: org.libsodium.libsodium.windows.${{ matrix.arch }}.*.nupkg + uses: ./.github/workflows/bcny-build-nuget-package.yml + with: + arch: ${{ matrix.arch }} + platform: ${{ matrix.platform }} + + # publish_nuget_package: + # name: "Publish nuget package" + # runs-on: windows-latest + # needs: publish_nuget_package + # strategy: + # fail-fast: false + # matrix: + # include: + # - arch: 'amd64' + # platform: 'x64' + # - arch: 'arm64' + # platform: 'ARM64' + + # - name: Publish NuGet Packages + # env: + # NUGET_SOURCE_NAME: TheBrowserCompany + # NUGET_SOURCE_URL: https://nuget.pkg.github.com/thebrowsercompany/index.json + # NUGET_SOURCE_USERNAME: thebrowsercompany-bot2 + # NUGET_SOURCE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + # NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} + # run: | + # if ((nuget sources List | Select-String "${env:NUGET_SOURCE_NAME}").Count -gt 0) { + # nuget sources Remove -Name "${env:NUGET_SOURCE_NAME}" + # } + # nuget sources Add -Name ${env:NUGET_SOURCE_NAME} -Source ${env:NUGET_SOURCE_URL} -Username ${env:NUGET_SOURCE_USERNAME} -Password ${env:NUGET_SOURCE_PASSWORD} -StorePasswordInClearText + # nuget setApiKey ${env:NUGET_API_KEY} -Source ${env:NUGET_SOURCE_URL} + # $pkgs = Get-ChildItem -Path org.libsodium.libsodium.windows.${{ matrix.arch }}.*.nupkg + # nuget push $pkgs[0].Name -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate + # shell: pwsh \ No newline at end of file