From 3893a4c7a8764ea38e616c32ecacb7bfcf44de9e Mon Sep 17 00:00:00 2001 From: Eugene Boguslavsky Date: Wed, 24 Jan 2024 00:56:54 +0000 Subject: [PATCH] Adding support to publish sui to chocolatey --- .github/workflows/release.yml | 246 +++++++++++++++++++--------------- chocolatey/sui.nuspec | 27 ++++ 2 files changed, 162 insertions(+), 111 deletions(-) create mode 100644 chocolatey/sui.nuspec diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39ee0c098649c..95ff7663e3af1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,8 @@ jobs: timeout-minutes: 80 strategy: matrix: - os: [ windows-ghcloud, ubuntu-ghcloud, macos-latest-xl, macos-arm64-self-hosted ] + # os: [ windows-ghcloud, ubuntu-ghcloud, macos-latest-xl, macos-arm64-self-hosted ] + os: [ windows-ghcloud ] fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -75,18 +76,18 @@ jobs: export os_type="${system_os}-${arch}" echo "os_type=${system_os}-${arch}" >> $GITHUB_ENV - - name: Check if archives of binaries have already been built - continue-on-error: true - shell: bash - run: | - echo "s3_archive_exist=$(curl -Is https://sui-releases.s3.us-east-1.amazonaws.com/releases/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz | head -n 1 | grep '200 OK')" >> $GITHUB_ENV + # - name: Check if archives of binaries have already been built + # continue-on-error: true + # shell: bash + # run: | + # echo "s3_archive_exist=$(curl -Is https://sui-releases.s3.us-east-1.amazonaws.com/releases/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz | head -n 1 | grep '200 OK')" >> $GITHUB_ENV - - name: Download archive, if it exists - if: ${{ env.s3_archive_exist != '' }} - shell: bash - run: | - mkdir -p ./target/release - aws s3 cp s3://sui-releases/releases/sui-${{ env.sui_tag }}-${os_type}.tgz ./target/release/sui-${{ env.sui_tag }}-${os_type}.tgz + # - name: Download archive, if it exists + # if: ${{ env.s3_archive_exist != '' }} + # shell: bash + # run: | + # mkdir -p ./target/release + # aws s3 cp s3://sui-releases/releases/sui-${{ env.sui_tag }}-${os_type}.tgz ./target/release/sui-${{ env.sui_tag }}-${os_type}.tgz - name: Setup caching if: ${{ env.s3_archive_exist == '' }} @@ -124,8 +125,9 @@ jobs: if: ${{ env.s3_archive_exist == '' }} shell: bash run: | - [ -f ~/.cargo/env ] && source ~/.cargo/env ; cargo build --release - cd external-crates/move && cargo build -p move-analyzer --release + # [ -f ~/.cargo/env ] && source ~/.cargo/env ; cargo build --release + # cd external-crates/move && cargo build -p move-analyzer --release + [ -f ~/.cargo/env ] && source ~/.cargo/env ; cargo build --bin sui --release - name: Rename binaries for ${{ matrix.os }} if: ${{ matrix.os != 'windows-ghcloud' && env.s3_archive_exist == '' }} @@ -146,115 +148,137 @@ jobs: if: ${{ matrix.os == 'windows-ghcloud' && env.s3_archive_exist == '' }} shell: bash run: | - [ -f ./target/release/sui.exe ] && mv ./target/release/sui.exe ./target/release/sui-${os_type}.exe - [ -f ./target/release/sui-node.exe ] && mv ./target/release/sui-node.exe ./target/release/sui-node-${os_type}.exe - [ -f ./target/release/sui-tool.exe ] && mv ./target/release/sui-tool.exe ./target/release/sui-tool-${os_type}.exe - [ -f ./target/release/sui-faucet.exe ] && mv ./target/release/sui-faucet.exe ./target/release/sui-faucet-${os_type}.exe - [ -f ./target/release/sui-test-validator.exe ] && mv ./target/release/sui-test-validator.exe ./target/release/sui-test-validator-${os_type}.exe - [ -f ./target/release/sui-indexer.exe ] && mv ./target/release/sui-indexer.exe ./target/release/sui-indexer-${os_type}.exe - [ -f ./target/release/sui-data-ingestion.exe ] && mv ./target/release/sui-data-ingestion.exe ./target/release/sui-data-ingestion-${os_type}.exe - [ -f ./external-crates/move/target/release/move-analyzer.exe ] && mv ./external-crates/move/target/release/move-analyzer.exe ./external-crates/move/target/release/move-analyzer-${os_type}.exe + [ -f ./target/release/sui.exe ] && cp ./target/release/sui.exe ./target/release/sui-${os_type}.exe + # [ -f ./target/release/sui-node.exe ] && mv ./target/release/sui-node.exe ./target/release/sui-node-${os_type}.exe + # [ -f ./target/release/sui-tool.exe ] && mv ./target/release/sui-tool.exe ./target/release/sui-tool-${os_type}.exe + # [ -f ./target/release/sui-faucet.exe ] && mv ./target/release/sui-faucet.exe ./target/release/sui-faucet-${os_type}.exe + # [ -f ./target/release/sui-test-validator.exe ] && mv ./target/release/sui-test-validator.exe ./target/release/sui-test-validator-${os_type}.exe + # [ -f ./target/release/sui-indexer.exe ] && mv ./target/release/sui-indexer.exe ./target/release/sui-indexer-${os_type}.exe + # [ -f ./target/release/sui-data-ingestion.exe ] && mv ./target/release/sui-data-ingestion.exe ./target/release/sui-data-ingestion-${os_type}.exe + # [ -f ./external-crates/move/target/release/move-analyzer.exe ] && mv ./external-crates/move/target/release/move-analyzer.exe ./external-crates/move/target/release/move-analyzer-${os_type}.exe tar -cvzf ./target/release/sui-${{ env.sui_tag }}-${os_type}.tgz ./target/release/sui*-${os_type}* ./external-crates/move/target/release/move-analyzer-${os_type}.exe - [[ ${{ env.sui_tag }} == *"mainnet"* ]] && aws s3 cp ./target/release/sui-${{ env.sui_tag }}-${os_type}.tgz s3://sui-releases/releases/sui-${{ env.sui_tag }}-${os_type}.tgz || true + # [[ ${{ env.sui_tag }} == *"mainnet"* ]] && aws s3 cp ./target/release/sui-${{ env.sui_tag }}-${os_type}.tgz s3://sui-releases/releases/sui-${{ env.sui_tag }}-${os_type}.tgz || true + + - name: "Publish Windows sui binary to Chocolately" + if: ${{ matrix.os == 'windows-ghcloud' && env.s3_archive_exist == '' && contains( env.sui_tag, 'mainnet') }} + working-directory: ./chocolatey + shell: bash + run: | + echo "sui_version=$(echo ${{ env.sui_tag }} | sed s/'mainnet-v'//)" >> $GITHUB_ENV + choco install checksum + echo "sui_sha=$(checksum -t sha256 ./target/release/sui.exe)" >> $GITHUB_ENV - - name: Upload release artifacts for ${{ matrix.os }} platform - uses: actions/upload-artifact@v3 - with: - name: sui-binaries-${{ matrix.os }} - if-no-files-found: error - path: | - ./target/release/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz + cat <>VERIFICATION.txt + Sui Binary verification steps + 1. Go to https://github.com/MystenLabs/sui/releases/download/${{ env.sui_tag }}/sui-${{ env.sui_tag }}-windows-x86_64.tgz + 2. Extract sui-windows-x86_64.exe + 3. checksum.exe -t sha256 sui-windows-x86_64.exe: ${{ env.sui_sha }} - - name: Publish binaries for ${{ env.sui_tag }} release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ env.sui_tag }} - files: | - ./target/release/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz + File 'LICENSE.txt' is obtained from: https://github.com/MystenLabs/sui/blob/main/LICENSE + EOF - update-homebrew-formula: - name: Push binaries to homebrew - needs: release-build - runs-on: ubuntu-latest - if: ${{ contains( inputs.sui_tag, 'mainnet') || contains( github.ref, 'mainnet') }} - steps: - - name: Clean up tag name ${{ env.TAG_NAME }} - shell: bash - run: | - echo "sui_tag=$(echo ${{ env.TAG_NAME }} | sed s/'refs\/tags\/'//)" >> $GITHUB_ENV + choco pack --version ${{ env.sui_version }} configuration=release + choco apikey --api-key ${{ secrets.CHOCO_API_KEY }} --source https://push.chocolatey.org/ + choco push sui.${{ env.sui_version }}.nupkg --source https://push.chocolatey.org/ - # Checkout MystenLabs/homebrew-tap - - name: Checkout Target Repository - uses: actions/checkout@v3 - with: - repository: MystenLabs/homebrew-tap - # @john's PAT, needs to be rotated jan 5 2024 - token: ${{ secrets.HOMEBREW_TAP_REPO_READ_WRITE }} - ref: main - fetch-depth: 0 + # - name: Upload release artifacts for ${{ matrix.os }} platform + # uses: actions/upload-artifact@v3 + # with: + # name: sui-binaries-${{ matrix.os }} + # if-no-files-found: error + # path: | + # ./target/release/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz - # Download all artifacts from the previous job - - name: Download all artifacts - uses: actions/download-artifact@v2 + # - name: Publish binaries for ${{ env.sui_tag }} release + # uses: softprops/action-gh-release@v1 + # with: + # tag_name: ${{ env.sui_tag }} + # files: | + # ./target/release/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz - - name: Fetch Ubuntu x86_64 Binary and Compute SHA256 - shell: bash - run: | - echo "sha256_ubuntu_release=$(sha256sum sui-binaries-ubuntu-ghcloud/sui-${{ env.sui_tag }}-ubuntu-x86_64.tgz | awk '{print $1}')" >> $GITHUB_ENV - echo "sha256_macos_x86_release=$(sha256sum sui-binaries-macos-latest-xl/sui-${{ env.sui_tag }}-macos-x86_64.tgz | awk '{print $1}')" >> $GITHUB_ENV - echo "sha256_macos_arm_release=$(sha256sum sui-binaries-macos-arm64-self-hosted/sui-${{ env.sui_tag }}-macos-arm64.tgz | awk '{print $1}' )" >> $GITHUB_ENV + # update-homebrew-formula: + # name: Push binaries to homebrew + # needs: release-build + # runs-on: ubuntu-latest + # if: ${{ contains( inputs.sui_tag, 'mainnet') || contains( github.ref, 'mainnet') }} + # steps: + # - name: Clean up tag name ${{ env.TAG_NAME }} + # shell: bash + # run: | + # echo "sui_tag=$(echo ${{ env.TAG_NAME }} | sed s/'refs\/tags\/'//)" >> $GITHUB_ENV + + # # Checkout MystenLabs/homebrew-tap + # - name: Checkout Target Repository + # uses: actions/checkout@v3 + # with: + # repository: MystenLabs/homebrew-tap + # # @john's PAT, needs to be rotated jan 5 2024 + # token: ${{ secrets.HOMEBREW_TAP_REPO_READ_WRITE }} + # ref: main + # fetch-depth: 0 + + # # Download all artifacts from the previous job + # - name: Download all artifacts + # uses: actions/download-artifact@v2 + + # - name: Fetch Ubuntu x86_64 Binary and Compute SHA256 + # shell: bash + # run: | + # echo "sha256_ubuntu_release=$(sha256sum sui-binaries-ubuntu-ghcloud/sui-${{ env.sui_tag }}-ubuntu-x86_64.tgz | awk '{print $1}')" >> $GITHUB_ENV + # echo "sha256_macos_x86_release=$(sha256sum sui-binaries-macos-latest-xl/sui-${{ env.sui_tag }}-macos-x86_64.tgz | awk '{print $1}')" >> $GITHUB_ENV + # echo "sha256_macos_arm_release=$(sha256sum sui-binaries-macos-arm64-self-hosted/sui-${{ env.sui_tag }}-macos-arm64.tgz | awk '{print $1}' )" >> $GITHUB_ENV - # Install Jinja2 for templating - - name: Install Jinja2 - run: pip install jinja2 + # # Install Jinja2 for templating + # - name: Install Jinja2 + # run: pip install jinja2 - - name: Apply Jinja2 Template and Update Formula - run: | - python3 - < + + + + sui + $version$ + sui + Main Sui Binary + sui + https://sui.io/ + https://github.com/MystenLabs/sui/blob/main/LICENSE + https://assets-global.website-files.com/6425f546844727ce5fb9e5ab/643775f4a15c9a9e10426daa_Sui_Favicon_256.png + https://github.com/MystenLabs/sui/ + https://github.com/MystenLabs/sui/issues + sui + https://community.chocolatey.org/packages/sui.portable + Run a local sui binary + Sui is the first internet-scale programmable blockchain platform + https://github.com/MystenLabs/sui/releases/tag/mainnet-v$version$ + + + + + + +