How to build archive per archieture in /releases

⚓ Rust    📅 2025-08-03    👤 surdeus    👁️ 11      

surdeus

Warning

This post was published 122 days ago. The information described in this article may have changed.

Hello,
I try to create a build.yml in /.github /workflows

that creates a source code.zipand per each archieturefor example:x86_64-pc-windows-gnux86_64-unknown-linux-gnuBut it did not workerror:name: morse build

on:

push:

branches: [ "main" ]

pull_request:

branches: [ "main" ]

env:

CARGO_TERM_COLOR: always

jobs:

build:

runs-on: ubuntu-latest

strategy:

fail-fast: false

matrix:

include:

      - target: x86_64-pc-windows-gnu

archive: zip

# - target: i686-pc-windows-gnu

# archive: zip

# - target: aarch64-pc-windows-gnullvm

# archive: zip

# - target: x86_64-unknown-linux-musl

# archive: tar.gz tar.xz tar.zst

# - target: i686-linux-gnu-gcc

# archive: tar.gz tar.xz tar.zst

      - target: x86_64-unknown-linux-gnu

archive: tar.gz tar.xz tar.zst

# - target: x86_64-apple-darwin

# archive: zip

# - target: aarch64-apple-darwin

# archive: zip

steps:

- name: install deps

run: sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get full-upgrade -y && sudo apt-get install pkg-config libssl-dev clang libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpango1.0-dev libgl1-mesa-dev libglu1-mesa-dev cmake gettext librust-alsa-dev librust-udev-dev libfltk1.3-dev libfltk1.3t64 mingw-w64 gcc-multilib curl g++ pkg-config libx11-dev libasound2-dev libudev-dev librust-alsa-sys-dev libasound2-dev upx-ucl

- uses: actions/checkout@v4

- name: rustup update

run: rustup up

- name: install cargo release

run: cargo install cargo-release

- name: Build

run: cargo build --verbose --release

- name: Run tests

run: cargo test --verbose

- name: cargo doc

run: cargo doc

- name: cargo release

env:

CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

run: cargo release --execute

- name: zip

run: |

ls -lathr /home/runner/work/rust-morse/rust-morse/target/release

cd ${{github.workspace}}

pwd

if target == x86_64-unknown-linux-gnu {

zip -r morse-linux-x64.zip /home/runner/work/rust-morse/rust-morse/target/release/morse /home/runner/work/rust-morse/rust-morse/icon.png /home/runner/work/rust-morse/rust-morse/de-DE.mo /home/runner/work/rust-morse/rust-morse/en-EN.mo /home/runner/work/rust-morse/rust-morse/license.txt -j

}

if target == x86_64-pc-windows-gnu {

zip -r morse-linux-x64.zip /home/runner/work/rust-morse/rust-morse/target/x86_64-pc-windows-gnu/release/morse.exe /home/runner/work/rust-morse/rust-morse/icon.png /home/runner/work/rust-morse/rust-morse/de-DE.mo /home/runner/work/rust-morse/rust-morse/en-EN.mo /home/runner/work/rust-morse/rust-morse/license.txt -j

}

- name: Upload

env:

GH_TOKEN: ${{ github.token }}

run: |

ls -lathr /home/runner/work/rust-morse/rust-morse/morse-linux-x64.zip

# gh release upload 0.0.1 /home/runner/work/rust-morse/rust-morse/morse-linux-x64.zip

- name: Release

env:

CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

run: |

echo "Releasing a version..."

cargo release --execute

1 post - 1 participant

Read full topic

🏷️ Rust_feed