Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for polywrap binary artifact upload in CD #1903

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 60 additions & 17 deletions .github/workflows/cd-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 --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 \
--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/${{ matrix.os }}-${{ matrix.arch }}/polywrap* | 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: cli-binary-${{ matrix.os }}-${{ matrix.arch }}
name: ${{ env.FILE_NAME }}
path: ${{ env.STANDALONE_BINARY_PATH }}

Publish-GitHub:
Expand Down Expand Up @@ -157,38 +194,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

- 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

- 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

- 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

- name: Download Artifacts win-x64
uses: actions/download-artifact@v3
with:
name: cli-binary-win-x64
path: ./bin/win-x64/
name: polywrap-win-x64.exe
path: ./bin

- name: Download Artifacts win-arm64
uses: actions/download-artifact@v3
with:
name: cli-binary-win-arm64
path: ./bin/win-arm64/
name: polywrap-win-arm64.exe
path: ./bin

- name: Create Release
id: create_release
Expand All @@ -204,7 +241,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.exe
./bin/polywrap-win-arm64.exe

- uses: actions/github-script@0.8.0
if: env.TAG_EXISTS == 'false'
Expand Down
Loading