From 568d9209d4493b26545414c3e84676cae92258db Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 1 Feb 2024 17:56:48 +0100 Subject: [PATCH] fix: use docker image --- .github/workflows/build-linux.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index b2d3cdad..6e338b18 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -20,6 +20,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build + id: build uses: docker/build-push-action@v5 with: build-args: | @@ -27,24 +28,24 @@ jobs: context: . file: ./Dockerfile.linux platforms: linux/amd64 - outputs: type=local,dest=./out + outputs: type=docker - name: Extract binaries from Docker image run: | - mkdir -p root/pkg-fetch/dist - ls -l ./out - mv ./out/* root/pkg-fetch/dist + mkdir -p dist + CONTAINER_ID=$(docker create ${{ steps.build.outputs.imageid }}) + docker cp $CONTAINER_ID:/root/pkg-fetch/dist ./dist - name: Check if binary is compiled id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + (test -f ./dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-linux-x64 - path: root/pkg-fetch/dist/* + path: ./dist/* linux-arm64: runs-on: ubuntu-20.04 @@ -61,6 +62,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build + id: build uses: docker/build-push-action@v5 with: build-args: | @@ -70,21 +72,21 @@ jobs: context: . file: ./Dockerfile.linuxcross platforms: linux/amd64 - outputs: type=local,dest=./out + outputs: type=docker - name: Extract binaries from Docker image run: | - mkdir -p root/pkg-fetch/dist - ls -l ./out - mv ./out/* root/pkg-fetch/dist + mkdir -p dist + CONTAINER_ID=$(docker create ${{ steps.build.outputs.imageid }}) + docker cp $CONTAINER_ID:/root/pkg-fetch/dist ./dist - name: Check if binary is compiled id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + (test -f ./dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-linux-arm64 - path: root/pkg-fetch/dist/* + path: ./dist/*