From 62a653bfd8a01cee3a5387689b0404063e351a69 Mon Sep 17 00:00:00 2001 From: Pierre Barre Date: Sun, 6 Oct 2024 13:23:44 +0200 Subject: [PATCH] Fix windows build --- .github/workflows/rust.yml | 41 +++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 48dbaea..3993059 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,8 +2,7 @@ name: Rust Build and Release on: push: - branches: [ "master" ] - + branches: ["master"] env: CARGO_TERM_COLOR: always @@ -14,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ubuntu-latest, windows-latest, macos-latest] include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu @@ -39,17 +38,41 @@ jobs: command: build args: --release --target ${{ matrix.target }} - - name: Package Binary + - name: Debug - List build directory shell: bash run: | - binary_name="merklemap-cli" + echo "Listing target/${{ matrix.target }}/release directory:" + ls -la target/${{ matrix.target }}/release + + - name: Set binary name + run: | + BINARY_NAME="merklemap-cli" if [ "${{ matrix.os }}" = "windows-latest" ]; then - binary_name="${binary_name}.exe" + BINARY_NAME="${BINARY_NAME}.exe" + fi + echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV + + - name: Package Binary + shell: bash + run: | + echo "Packaging binary from: target/${{ matrix.target }}/release/${BINARY_NAME}" + if [ -f "target/${{ matrix.target }}/release/${BINARY_NAME}" ]; then + echo "Binary file exists" + tar -czvf "${BINARY_NAME}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${BINARY_NAME}" + echo "Packaging complete" + else + echo "Error: Binary file not found" + exit 1 fi - tar -czf "${binary_name}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${binary_name}" + + - name: Debug - List workspace + shell: bash + run: | + echo "Listing current directory:" + ls -la - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: merklemap-cli-${{ matrix.target }} - path: merklemap-cli-${{ matrix.target }}.tar.gz + name: ${BINARY_NAME}-${{ matrix.target }} + path: ${BINARY_NAME}-${{ matrix.target }}.tar.gz