From d84a9b6c1de7d9693b5641422c0742150d8a796b Mon Sep 17 00:00:00 2001 From: JeremyMoeglich Date: Sat, 2 Nov 2024 17:18:30 +0100 Subject: [PATCH] add more architectures fix windows build --- .github/workflows/releases.yml | 63 +++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 7644e04..d474fe3 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - "v*" # Triggers the workflow on version tags like v1.0.0 + - 'v*' # Triggers the workflow on version tags like v1.0.0 jobs: build: @@ -14,13 +14,28 @@ jobs: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu - extension: "" + extension: '' + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + extension: '' + use-cross: true + - os: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + extension: '' + use-cross: true + - os: ubuntu-latest + target: riscv64gc-unknown-linux-gnu + extension: '' + use-cross: true - os: macos-latest target: x86_64-apple-darwin - extension: "" + extension: '' + - os: macos-11 + target: aarch64-apple-darwin + extension: '' - os: windows-latest target: x86_64-pc-windows-msvc - extension: ".exe" + extension: '.exe' steps: - name: Check out repository @@ -33,18 +48,50 @@ jobs: target: ${{ matrix.target }} override: true + - name: Install cross + if: matrix.use-cross == 'true' + run: cargo install cross + - name: Build the project - run: cargo build --release --target ${{ matrix.target }} + run: | + if [ "${{ matrix.use-cross }}" = "true" ]; then + cross build --release --target ${{ matrix.target }} + else + cargo build --release --target ${{ matrix.target }} + fi + shell: bash - - name: Prepare binary for release + - name: Prepare binary for release (Windows) + if: startsWith(matrix.os, 'windows') + run: | + mkdir release + Compress-Archive -Path target\${{ matrix.target }}\release\weaveconfig.exe -DestinationPath release\weaveconfig-${{ matrix.target }}.zip + shell: pwsh + + - name: Prepare binary for release (Others) + if: "!startsWith(matrix.os, 'windows')" run: | mkdir -p release zip -j release/weaveconfig-${{ matrix.target }}.zip target/${{ matrix.target }}/release/weaveconfig${{ matrix.extension }} shell: bash - - name: Upload Release Asset + - name: Generate checksum (Windows) + if: startsWith(matrix.os, 'windows') + run: | + CertUtil -hashfile release\weaveconfig-${{ matrix.target }}.zip SHA256 > release\weaveconfig-${{ matrix.target }}.zip.sha256 + shell: cmd + + - name: Generate checksum (Others) + if: "!startsWith(matrix.os, 'windows')" + run: | + shasum -a 256 release/weaveconfig-${{ matrix.target }}.zip > release/weaveconfig-${{ matrix.target }}.zip.sha256 + shell: bash + + - name: Upload Release Assets uses: softprops/action-gh-release@v1 with: - files: release/weaveconfig-${{ matrix.target }}.zip + files: | + release/weaveconfig-${{ matrix.target }}.zip + release/weaveconfig-${{ matrix.target }}.zip.sha256 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}