From c1e9227d0bbc3ff0b83b4ba65d8dfab1da05cac1 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:13:03 +0530 Subject: [PATCH 01/12] initial release workflow for windows --- .github/workflows/release.yml | 85 ++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55dc2906..b7b8edb0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,7 +91,7 @@ jobs: cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-linux-amd64.zip ${{ env.APP_NAME }} config.yaml - - name: Upload Zip for Darwin/amd64 + - name: Upload Zip for linux/amd64 uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-linux-amd64 @@ -120,7 +120,7 @@ jobs: cd ${{ env.OUTPUT_DIR }} zip -qq -r ${{ env.APP_NAME }}-linux-arm64.zip ${{ env.APP_NAME }} config.yaml - - name: Upload Zip for Darwin/arm64 + - name: Upload Zip for linux/arm64 uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-linux-arm64 @@ -221,3 +221,84 @@ jobs: asset_path: ${{ env.OUTPUT_DIR }}/arm64/${{ env.APP_NAME }}-darwin-arm64.zip asset_name: ${{ env.APP_NAME }}-darwin-arm64.zip asset_content_type: application/zip + + windows: + runs-on: windows-latest + needs: create_release + env: + SRC_DIR: ${{ github.workspace }}\src + OUTPUT_DIR: ${{ github.workspace }}\output + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Install MinGW for CGo + run: | + choco install mingw + + - name: Setup + run : | + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\arm64" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\arm64\" + + - name: Build ${{ env.APP_NAME }} for amd64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + + - name: Build ${{ env.APP_NAME }} for arm64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + CGO_ENABLED=1 CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ GOOS=windows GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . + + - name: Create Zip File for windows/amd64 + run: | + Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" + Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip + + - name: Upload Zip for windows/amd64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-windows-amd64 + path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip + + - name: Create Zip File for windows/arm64 + run: | + Set-Location -Path "${{ env.OUTPUT_DIR }}\arm64" + Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-arm64.zip + + - name: Upload Zip for windows/arm64 + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-windows-arm64 + path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + + - name: Upload Release Asset for windows/amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip + asset_name: ${{ env.APP_NAME }}-windows-amd64.zip + asset_content_type: application/zip + + - name: Upload Release Asset for windows/arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + asset_name: ${{ env.APP_NAME }}-windows-arm64.zip + asset_content_type: application/zip + \ No newline at end of file From 7fbdd174c87f7b9da4bbc3ca535044f897d392e9 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:27:08 +0530 Subject: [PATCH 02/12] fix release workflow --- .github/workflows/release.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7b8edb0..40ab7284 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -253,13 +253,29 @@ jobs: - name: Build ${{ env.APP_NAME }} for amd64 run: | Set-Location -Path "${{ env.SRC_DIR }}" - CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + $env:CGO_ENABLED="1" + $env:CC="x86_64-w64-mingw32-gcc" + $env:CXX="x86_64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="amd64" + where x86_64-w64-mingw32-gcc + where x86_64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + shell: pwsh - name: Build ${{ env.APP_NAME }} for arm64 run: | Set-Location -Path "${{ env.SRC_DIR }}" - CGO_ENABLED=1 CC=aarch64-w64-mingw32-gcc CXX=aarch64-w64-mingw32-g++ GOOS=windows GOARCH=arm64 go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . - + $env:CGO_ENABLED="1" + $env:CC="aarch64-w64-mingw32-gcc" + $env:CXX="aarch64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="arm64" + where aarch64-w64-mingw32-gcc + where aarch64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . + shell: pwsh + - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" From 87758d3f433371f6524141eea0bc6f6fe41a3c57 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 17:54:07 +0530 Subject: [PATCH 03/12] remove arm64 build --- .github/workflows/release.yml | 39 ++--------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40ab7284..06dd4b77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -246,10 +246,8 @@ jobs: - name: Setup run : | New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" - New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\arm64" Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" - Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\arm64\" - + - name: Build ${{ env.APP_NAME }} for amd64 run: | Set-Location -Path "${{ env.SRC_DIR }}" @@ -263,19 +261,6 @@ jobs: go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . shell: pwsh - - name: Build ${{ env.APP_NAME }} for arm64 - run: | - Set-Location -Path "${{ env.SRC_DIR }}" - $env:CGO_ENABLED="1" - $env:CC="aarch64-w64-mingw32-gcc" - $env:CXX="aarch64-w64-mingw32-g++" - $env:GOOS="windows" - $env:GOARCH="arm64" - where aarch64-w64-mingw32-gcc - where aarch64-w64-mingw32-g++ - go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}.exe . - shell: pwsh - - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" @@ -285,18 +270,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ env.APP_NAME }}-windows-amd64 - path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip - - - name: Create Zip File for windows/arm64 - run: | - Set-Location -Path "${{ env.OUTPUT_DIR }}\arm64" - Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-arm64.zip - - - name: Upload Zip for windows/arm64 - uses: actions/upload-artifact@v3 - with: - name: ${{ env.APP_NAME }}-windows-arm64 - path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip + path: ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}-windows-amd64.zip - name: Upload Release Asset for windows/amd64 uses: actions/upload-release-asset@v1 @@ -308,13 +282,4 @@ jobs: asset_name: ${{ env.APP_NAME }}-windows-amd64.zip asset_content_type: application/zip - - name: Upload Release Asset for windows/arm64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_path: ${{ env.OUTPUT_DIR }}\arm64\${{ env.APP_NAME }}-windows-arm64.zip - asset_name: ${{ env.APP_NAME }}-windows-arm64.zip - asset_content_type: application/zip \ No newline at end of file From 7c4cd0f5c2287a2a0967162ae0902e8da034a22f Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 30 Aug 2024 18:03:01 +0530 Subject: [PATCH 04/12] fix release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06dd4b77..ccf16cf4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -264,7 +264,7 @@ jobs: - name: Create Zip File for windows/amd64 run: | Set-Location -Path "${{ env.OUTPUT_DIR }}\amd64" - Compress-Archive -Path ${{ env.APP_NAME }}.exe config.yaml -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip + Compress-Archive -Path @("${{ env.APP_NAME }}.exe", "config.yaml") -DestinationPath ${{ env.APP_NAME }}-windows-amd64.zip - name: Upload Zip for windows/amd64 uses: actions/upload-artifact@v3 From f7a10e7b47e64d990d58eb5e0bbf4cccf36ec90e Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 1 Sep 2024 18:11:55 +0530 Subject: [PATCH 05/12] initial distribute workflow through choco --- ...zboxcli.yml => distribute-zboxcli-apt.yml} | 2 +- .../workflows/distribute-zboxcli-choco.yml | 90 +++++++++++++++++++ .github/workflows/release.yml | 4 +- 3 files changed, 93 insertions(+), 3 deletions(-) rename .github/workflows/{distribute-zboxcli.yml => distribute-zboxcli-apt.yml} (99%) create mode 100644 .github/workflows/distribute-zboxcli-choco.yml diff --git a/.github/workflows/distribute-zboxcli.yml b/.github/workflows/distribute-zboxcli-apt.yml similarity index 99% rename from .github/workflows/distribute-zboxcli.yml rename to .github/workflows/distribute-zboxcli-apt.yml index b930bdf5..eb5a170b 100644 --- a/.github/workflows/distribute-zboxcli.yml +++ b/.github/workflows/distribute-zboxcli-apt.yml @@ -1,4 +1,4 @@ -name: Build, Distribute and Test zbox +name: Distribute zbox using apt on: workflow_dispatch: diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml new file mode 100644 index 00000000..0a748ef1 --- /dev/null +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -0,0 +1,90 @@ +name: Distribute zbox using choco + +on: + # Remove push trigger once tested + push: + branches: + - windows-build + + workflow_dispatch: + inputs: + version: + description: 'Version of zbox to release' + required: true + default: '1.0.0' + +env: + APP_NAME: zbox + PACKAGE_ID: zbox + APP_VERSION: '1.17.0' # Update to ${{ github.event.inputs.version }} once tested + GO_VERSION: '1.21' + +jobs: + build: + runs-on: windows-latest + env: + SRC_DIR: ${{ github.workspace }}\src + OUTPUT_DIR: ${{ github.workspace }}\output + PACKAGE_DIR: ${{ github.workspace }}\package + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + path: ${{ env.SRC_DIR }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install MinGW for CGo + run: | + choco install mingw + + - name: Setup + run : | + New-Item -ItemType Directory -Force -Path "${{ env.OUTPUT_DIR }}\amd64" + New-Item -ItemType Directory -Force -Path "${{ env.PACKAGE_DIR }}" + Copy-Item -Force -Path "${{ env.SRC_DIR }}\cmd\config.yaml" -Destination "${{ env.OUTPUT_DIR }}\amd64\" + + - name: Build ${{ env.APP_NAME }} for amd64 + run: | + Set-Location -Path "${{ env.SRC_DIR }}" + $env:CGO_ENABLED="1" + $env:CC="x86_64-w64-mingw32-gcc" + $env:CXX="x86_64-w64-mingw32-g++" + $env:GOOS="windows" + $env:GOARCH="amd64" + where x86_64-w64-mingw32-gcc + where x86_64-w64-mingw32-g++ + go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.APP_VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . + shell: pwsh + + - name: Create .nuspec file + run: | + Set-Location "${{ env.PACKAGE_DIR }}" + $content = @" + + + + ${{ env.PACKAGE_ID }} + ${{ env.APP_VERSION }} + https://github.com/0chain/zboxcli/blob/staging/LICENSE + https://github.com/0chain/zboxcli + zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. + + + + + + "@ + Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content + + - name: Pack Chocolatey Package + run: | + choco pack ${{ env.PACKAGE_ID }}.nuspec + + - name: Push Chocolatey Package + run: | + choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccf16cf4..2a3a3c37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,7 +161,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version: ${{ env.GO_VERSION }} - name: Setup run : | @@ -237,7 +237,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version: ${{ env.GO_VERSION }} - name: Install MinGW for CGo run: | From 0bb45f6e538ac2cc6e1fea3803aa1dbfa9dc18c4 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Sun, 1 Sep 2024 18:25:42 +0530 Subject: [PATCH 06/12] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 0a748ef1..c98ad06e 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -63,7 +63,7 @@ jobs: - name: Create .nuspec file run: | - Set-Location "${{ env.PACKAGE_DIR }}" + Set-Location -Path "${{ env.PACKAGE_DIR }}" $content = @" @@ -79,10 +79,14 @@ jobs: "@ + + New-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -ItemType File -Force Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content - name: Pack Chocolatey Package run: | + Get-Location + Get-ChildItem "${{ env.PACKAGE_DIR }}" choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package From 0ca5200082937c2363550b96976f6322e270e76c Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 2 Sep 2024 18:00:39 +0530 Subject: [PATCH 07/12] fix distribute wokflow --- .github/workflows/distribute-zboxcli-choco.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index c98ad06e..79a5b683 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -64,6 +64,9 @@ jobs: - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" + Write-Host "Current Directory After Set-Location:" + Get-Location + Write-Host "Creating .nuspec file..." $content = @" @@ -86,7 +89,9 @@ jobs: - name: Pack Chocolatey Package run: | Get-Location - Get-ChildItem "${{ env.PACKAGE_DIR }}" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + Move-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -Destination "${{ env.PACKAGE_DIR }}" + Set-Location -Path "${{ env.PACKAGE_DIR }}" choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package From de9c4351a09e7b1e4ce7d6f292fc215abfe09aa6 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 2 Sep 2024 18:22:49 +0530 Subject: [PATCH 08/12] fix distribute release workflow --- .../workflows/distribute-zboxcli-choco.yml | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 79a5b683..d1de1ff4 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -64,9 +64,10 @@ jobs: - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" - Write-Host "Current Directory After Set-Location:" - Get-Location - Write-Host "Creating .nuspec file..." + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" $content = @" @@ -82,17 +83,22 @@ jobs: "@ + + $content | Out-File -FilePath "zbox.nuspec" -Encoding utf8 + Write-Host "Created .nuspec file:" + Get-ChildItem "${{ env.PACKAGE_DIR }}" - New-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -ItemType File -Force - Set-Content -Path "${{ env.PACKAGE_ID }}.nuspec" -Value $content + $fileContent = Get-Content -Path "zbox.nuspec" + Write-Host "File Content: $fileContent" - name: Pack Chocolatey Package run: | - Get-Location - Get-ChildItem "${{ env.PACKAGE_DIR }}" - Move-Item -Path "${{ env.PACKAGE_ID }}.nuspec" -Destination "${{ env.PACKAGE_DIR }}" - Set-Location -Path "${{ env.PACKAGE_DIR }}" - choco pack ${{ env.PACKAGE_ID }}.nuspec + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + choco pack ${{ env.PACKAGE_ID }}.nuspec - name: Push Chocolatey Package run: | From e7c9e9427cfabfb05f9e12072cd68d10ab2a8fa7 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 3 Sep 2024 09:54:34 +0530 Subject: [PATCH 09/12] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index d1de1ff4..bcbd82c6 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -74,6 +74,8 @@ jobs: ${{ env.PACKAGE_ID }} ${{ env.APP_VERSION }} + Saswata Basu + Saswata Basu https://github.com/0chain/zboxcli/blob/staging/LICENSE https://github.com/0chain/zboxcli zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. From 30fb79e81281586eaa917ce60b46e7adfe7212b1 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Tue, 3 Sep 2024 10:02:16 +0530 Subject: [PATCH 10/12] fix distribute workflow --- .github/workflows/distribute-zboxcli-choco.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index bcbd82c6..d0909444 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -104,4 +104,9 @@ jobs: - name: Push Chocolatey Package run: | - choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} From b33f30040a5c8285e37285fb08f0cb132c33de28 Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Fri, 6 Sep 2024 16:28:52 +0530 Subject: [PATCH 11/12] resolve requirements --- .../workflows/distribute-zboxcli-choco.yml | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index d0909444..6c9c6dbc 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -61,6 +61,66 @@ jobs: go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.APP_VERSION }}" -o ${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe . shell: pwsh + - name: Generate SHA256 Checksum + id: checksum + shell: pwsh + run: | + $checksum = Get-FileHash "${{ env.OUTPUT_DIR }}\amd64\${{ env.APP_NAME }}.exe" -Algorithm SHA256 + Write-Output "::set-output name=checksum::$($checksum.Hash)" + + - name: Create VERIFICATION.txt + shell: pwsh + run: | + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + + $verificationContent = @" + The binaries in this package were sourced from the official https://github.com/0chain/zboxcli repository. + + Verification Steps: + 1. The SHA256 checksum of the binary was calculated. + 2. Users can verify the binary themselves by running the following command: + `Get-FileHash -Algorithm SHA256 ${{ env.APP_NAME }}.exe` + + Expected checksum: + ${{ steps.checksum.outputs.checksum }} + "@ + + $verificationContent | Out-File -FilePath "VERIFICATION.txt" -Encoding utf8 + Write-Host "Created VERIFICATION.txt file" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + + $fileContent = Get-Content -Path "VERIFICATION.txt" + Write-Host "File Content: $fileContent" + + - name: Create Chocolatey Install Script + run: | + Set-Location -Path "${{ env.PACKAGE_DIR }}" + $location = Get-Location + Write-Host "Current Directory: $location" + $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" + Write-Host "Files in Directory: $files" + + $content = @' + $installDir = "$(Get-ToolsLocation)\zbox" + $envPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + + if ($envPath -notlike "*$installDir*") { + Write-Host "Adding $installDir to PATH" + [System.Environment]::SetEnvironmentVariable('Path', "$envPath;$installDir", 'Machine') + } + '@ + + $content | Out-File -FilePath "chocolateyInstall.ps1" -Encoding utf8 + Write-Host "Created chocolateyInstall.ps1 file" + Get-ChildItem "${{ env.PACKAGE_DIR }}" + + $fileContent = Get-Content -Path "chocolateyInstall.ps1" + Write-Host "File Content: $fileContent" + - name: Create .nuspec file run: | Set-Location -Path "${{ env.PACKAGE_DIR }}" @@ -76,12 +136,20 @@ jobs: ${{ env.APP_VERSION }} Saswata Basu Saswata Basu + zbox cloud storage cli windows golang https://github.com/0chain/zboxcli/blob/staging/LICENSE https://github.com/0chain/zboxcli + https://github.com/0chain/zboxcli + https://github.com/0chain/zboxcli/releases/latest + zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. zbox is a command line interface (CLI) tool to understand the capabilities of Züs dStorage and prototype your app. + zbox CLI + + + "@ @@ -110,3 +178,19 @@ jobs: $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" Write-Host "Files in Directory: $files" choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} + + verify-install: + runs-on: windows-latest + needs: build + + steps: + - name: Install zbox via Chocolatey + run: choco install zbox --version {{ env.APP_VERSION }} --source="https://push.chocolatey.org/" + + - name: Verify zbox Installation + run: | + if (Get-Command zbox -ErrorAction SilentlyContinue) { + Write-Output "zbox is installed successfully!" + } else { + throw "zbox installation failed!" + } From 2139c3a1de246047d4ed12d41760d0d2f451774c Mon Sep 17 00:00:00 2001 From: Arun Ramanathan Date: Mon, 9 Sep 2024 18:54:29 +0530 Subject: [PATCH 12/12] refactor --- .../workflows/distribute-zboxcli-choco.yml | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/distribute-zboxcli-choco.yml b/.github/workflows/distribute-zboxcli-choco.yml index 6c9c6dbc..f6e6fc4a 100644 --- a/.github/workflows/distribute-zboxcli-choco.yml +++ b/.github/workflows/distribute-zboxcli-choco.yml @@ -1,11 +1,6 @@ name: Distribute zbox using choco on: - # Remove push trigger once tested - push: - branches: - - windows-build - workflow_dispatch: inputs: version: @@ -16,7 +11,7 @@ on: env: APP_NAME: zbox PACKAGE_ID: zbox - APP_VERSION: '1.17.0' # Update to ${{ github.event.inputs.version }} once tested + APP_VERSION: ${{ github.event.inputs.version }} GO_VERSION: '1.21' jobs: @@ -178,19 +173,3 @@ jobs: $files = Get-ChildItem "${{ env.PACKAGE_DIR }}" Write-Host "Files in Directory: $files" choco push ${{ env.PACKAGE_ID }}.${{ env.APP_VERSION }}.nupkg --source https://push.chocolatey.org/ -k ${{ secrets.CHOCOLATEY_API_KEY }} - - verify-install: - runs-on: windows-latest - needs: build - - steps: - - name: Install zbox via Chocolatey - run: choco install zbox --version {{ env.APP_VERSION }} --source="https://push.chocolatey.org/" - - - name: Verify zbox Installation - run: | - if (Get-Command zbox -ErrorAction SilentlyContinue) { - Write-Output "zbox is installed successfully!" - } else { - throw "zbox installation failed!" - }