Skip to content

Commit

Permalink
add more architectures fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMoeglich committed Nov 2, 2024
1 parent 898fcbb commit d84a9b6
Showing 1 changed file with 55 additions and 8 deletions.
63 changes: 55 additions & 8 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit d84a9b6

Please sign in to comment.