Skip to content

Commit

Permalink
Update release workflow to correctly build binaries for archs
Browse files Browse the repository at this point in the history
  • Loading branch information
chvck committed Mar 14, 2023
1 parent e056de2 commit d9f3689
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,35 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, aarch64-linux-gnu, macos, aarch64-macos, windows]
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-msvc]
include:
- build: linux
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
rust: stable
builddir: debug
- build: aarch64-linux-gnu
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
rust: stable
builddir: aarch64-unknown-linux-gnu/debug
- build: aarch64-macos
- target: aarch64-apple-darwin
os: macos-latest
rust: stable
builddir: aarch64-apple-darwin/debug
- build: macos
- target: x86_64-apple-darwin
os: macos-latest
rust: stable
- build: windows
- target: x86_64-pc-windows-msvc
os: windows-latest
rust: stable
outputs:
version: ${{ steps.version.outputs.value }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Update Rust Toolchain Target
run: |
echo "targets = ['${{matrix.target}}']" >> rust-toolchain.toml
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/[email protected]

- name: Install aarch64-linux gcc
run: sudo apt-get install gcc-aarch64-linux-gnu -y
if: matrix.target == 'aarch64-unknown-linux-gnu'

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: SebRollen/[email protected]
id: version
with:
Expand All @@ -63,9 +60,11 @@ jobs:

- name: Build
uses: actions-rs/cargo@v1
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc'
with:
command: build
args: --verbose --release
args: --verbose --release --target ${{ matrix.target }}
if: matrix.os != 'windows-latest'

- name: Build
Expand All @@ -87,7 +86,7 @@ jobs:
- name: Create archive for Linux
id: createarchivelinux
run: |
7z a -ttar -so -an ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7z a -si ${{ env.RELEASE_BIN }}-${{ matrix.build }}.tar.gz
7z a -ttar -so -an ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7z a -si ${{ env.RELEASE_BIN }}-${{ matrix.target }}.tar.gz
if: matrix.os == 'ubuntu-22.04'

- name: Install p7zip
Expand All @@ -98,21 +97,21 @@ jobs:
- name: Create archive for MacOS
id: createarchivemacos
run: |
7z a -tzip ${{ env.RELEASE_BIN }}-${{ matrix.build }}.zip ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}
7z a -tzip ${{ env.RELEASE_BIN }}-${{ matrix.target }}.zip ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}
if: matrix.os == 'macos-latest'

- name: Create archive for Windows
id: createarchivewindows
run: |
choco install 7zip
7z a -tzip ${{ env.RELEASE_BIN }}-${{ matrix.build }}.zip ./target/release/${{ env.RELEASE_BIN_WINDOWS }} ${{ env.RELEASE_ADDS }}
7z a -tzip ${{ env.RELEASE_BIN }}-${{ matrix.target }}.zip ./target/release/${{ env.RELEASE_BIN_WINDOWS }} ${{ env.RELEASE_ADDS }}
if: matrix.os == 'windows-latest'

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-${{ matrix.build }}
path: ${{ env.RELEASE_BIN }}-${{ matrix.build }}*
name: ${{ env.RELEASE_BIN }}-${{ matrix.target }}
path: ${{ env.RELEASE_BIN }}-${{ matrix.target }}*
if-no-files-found: error

release:
Expand Down

0 comments on commit d9f3689

Please sign in to comment.