From 92cfdd95b07da7838494e0b2372eb3ea3c8e791d Mon Sep 17 00:00:00 2001 From: krisbitney Date: Mon, 11 Sep 2023 12:22:23 +0300 Subject: [PATCH 1/2] fix for polywrap binary artifact upload in CD --- .github/workflows/cd-source.yaml | 38 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cd-source.yaml b/.github/workflows/cd-source.yaml index 5a60e9110..b0a8e37bc 100644 --- a/.github/workflows/cd-source.yaml +++ b/.github/workflows/cd-source.yaml @@ -83,17 +83,17 @@ jobs: if: env.TAG_EXISTS == 'false' working-directory: ./packages/cli run: | - npx pkg --config ./package.json --target=${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} --output ./standalone-binaries/${{ matrix.os }}-${{ matrix.arch }}/polywrap --compress Brotli ./bin/polywrap + npx pkg . --target=${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} --output ./standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} --compress Brotli - name: Extract binary path if: env.TAG_EXISTS == 'false' - run: echo STANDALONE_BINARY_PATH=$(stat ./packages/cli/standalone-binaries/${{ matrix.os }}-${{ matrix.arch }}/polywrap* | awk '/File:/ {print $2}') >> $GITHUB_ENV + run: echo STANDALONE_BINARY_PATH=$(stat ./packages/cli/standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} | awk '/File:/ {print $2}') >> $GITHUB_ENV - name: Upload Artifacts if: env.TAG_EXISTS == 'false' uses: actions/upload-artifact@v3 with: - name: cli-binary-${{ matrix.os }}-${{ matrix.arch }} + name: polywrap-${{ matrix.os }}-${{ matrix.arch }} path: ${{ env.STANDALONE_BINARY_PATH }} Publish-GitHub: @@ -157,38 +157,38 @@ jobs: - name: Download Artifacts linux-x64 uses: actions/download-artifact@v3 with: - name: cli-binary-linux-x64 - path: ./bin/linux-x64/ + name: polywrap-linux-x64 + path: ./bin/polywrap-linux-x64 - name: Download Artifacts linux-arm64 uses: actions/download-artifact@v3 with: - name: cli-binary-linux-arm64 - path: ./bin/linux-arm64/ + name: polywrap-linux-arm64 + path: ./bin/polywrap-linux-arm64 - name: Download Artifacts macos-x64 uses: actions/download-artifact@v3 with: - name: cli-binary-macos-x64 - path: ./bin/macos-x64/ + name: polywrap-macos-x64 + path: ./bin/polywrap-macos-x64 - name: Download Artifacts macos-arm64 uses: actions/download-artifact@v3 with: - name: cli-binary-macos-arm64 - path: ./bin/macos-arm64/ + name: polywrap-macos-arm64 + path: ./bin/polywrap-macos-arm64 - name: Download Artifacts win-x64 uses: actions/download-artifact@v3 with: - name: cli-binary-win-x64 - path: ./bin/win-x64/ + name: polywrap-win-x64 + path: ./bin/polywrap-win-x64 - name: Download Artifacts win-arm64 uses: actions/download-artifact@v3 with: - name: cli-binary-win-arm64 - path: ./bin/win-arm64/ + name: polywrap-win-arm64 + path: ./bin/polywrap-win-arm64 - name: Create Release id: create_release @@ -204,7 +204,13 @@ jobs: ${{ github.event.pull_request.body }} draft: false prerelease: false - files: ./bin + files: | + ./bin/polywrap-linux-x64 + ./bin/polywrap-linux-arm64 + ./bin/polywrap-macos-x64 + ./bin/polywrap-macos-arm64 + ./bin/polywrap-win-x64 + ./bin/polywrap-win-arm64 - uses: actions/github-script@0.8.0 if: env.TAG_EXISTS == 'false' From 5a968affa48ab64f19df6cbfc8c0da44b831fb61 Mon Sep 17 00:00:00 2001 From: krisbitney Date: Wed, 13 Sep 2023 20:01:06 +0300 Subject: [PATCH 2/2] fixes for cli release cd --- .github/workflows/cd-source.yaml | 67 +++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cd-source.yaml b/.github/workflows/cd-source.yaml index b0a8e37bc..20d2fb38b 100644 --- a/.github/workflows/cd-source.yaml +++ b/.github/workflows/cd-source.yaml @@ -80,20 +80,57 @@ jobs: yarn build - name: Package into standalone binary - if: env.TAG_EXISTS == 'false' + if: env.TAG_EXISTS == 'false' && startsWith(matrix.arch, 'arm64') + uses: uraimo/run-on-arch-action@v2 + with: + arch: aarch64 + distro: ubuntu18.04 + githubToken: ${{ secrets.GITHUB_TOKEN }} + install: | + apt update && apt -y install curl + curl -fsSL https://deb.nodesource.com/setup_14.x | bash - + apt-get install -y nodejs + curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list + apt update && apt -y install yarn + yarn global add pkg@5.8.1 --prefix /usr/local + pkg --version + run: | + pkg \ + --config ./packages/cli/package.json \ + --target=${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} \ + --output ./packages/cli/standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} \ + --debug \ + --compress Brotli \ + ./packages/cli/bin/polywrap + + - name: Package into standalone binary + if: env.TAG_EXISTS == 'false' && startsWith(matrix.arch, 'x64') working-directory: ./packages/cli run: | - npx pkg . --target=${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} --output ./standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} --compress Brotli + npx pkg \ + --config ./package.json \ + --target=${{ matrix.node-version }}-${{ matrix.os }}-${{ matrix.arch }} \ + --output ./standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} \ + --compress Brotli \ + ./bin/polywrap - name: Extract binary path if: env.TAG_EXISTS == 'false' - run: echo STANDALONE_BINARY_PATH=$(stat ./packages/cli/standalone-binaries/polywrap-${{ matrix.os }}-${{ matrix.arch }} | awk '/File:/ {print $2}') >> $GITHUB_ENV + run: | + if [[ "${{ matrix.os }}" == "win" ]]; then + FILE_NAME="polywrap-${{ matrix.os }}-${{ matrix.arch }}.exe" + else + FILE_NAME="polywrap-${{ matrix.os }}-${{ matrix.arch }}" + fi + echo STANDALONE_BINARY_PATH=$(stat ./packages/cli/standalone-binaries/$FILE_NAME | awk '/File:/ {print $2}') >> $GITHUB_ENV + echo FILE_NAME=$FILE_NAME >> $GITHUB_ENV - name: Upload Artifacts if: env.TAG_EXISTS == 'false' uses: actions/upload-artifact@v3 with: - name: polywrap-${{ matrix.os }}-${{ matrix.arch }} + name: ${{ env.FILE_NAME }} path: ${{ env.STANDALONE_BINARY_PATH }} Publish-GitHub: @@ -158,37 +195,37 @@ jobs: uses: actions/download-artifact@v3 with: name: polywrap-linux-x64 - path: ./bin/polywrap-linux-x64 + path: ./bin - name: Download Artifacts linux-arm64 uses: actions/download-artifact@v3 with: name: polywrap-linux-arm64 - path: ./bin/polywrap-linux-arm64 + path: ./bin - name: Download Artifacts macos-x64 uses: actions/download-artifact@v3 with: name: polywrap-macos-x64 - path: ./bin/polywrap-macos-x64 + path: ./bin - name: Download Artifacts macos-arm64 uses: actions/download-artifact@v3 with: name: polywrap-macos-arm64 - path: ./bin/polywrap-macos-arm64 + path: ./bin - name: Download Artifacts win-x64 uses: actions/download-artifact@v3 with: - name: polywrap-win-x64 - path: ./bin/polywrap-win-x64 + name: polywrap-win-x64.exe + path: ./bin - name: Download Artifacts win-arm64 uses: actions/download-artifact@v3 with: - name: polywrap-win-arm64 - path: ./bin/polywrap-win-arm64 + name: polywrap-win-arm64.exe + path: ./bin - name: Create Release id: create_release @@ -204,13 +241,13 @@ jobs: ${{ github.event.pull_request.body }} draft: false prerelease: false - files: | + files: | ./bin/polywrap-linux-x64 ./bin/polywrap-linux-arm64 ./bin/polywrap-macos-x64 ./bin/polywrap-macos-arm64 - ./bin/polywrap-win-x64 - ./bin/polywrap-win-arm64 + ./bin/polywrap-win-x64.exe + ./bin/polywrap-win-arm64.exe - uses: actions/github-script@0.8.0 if: env.TAG_EXISTS == 'false'