How to build archive per archieture in /releases

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

Consider using Markdown code blocks in your post to make the code readable:

```yaml
Code here
```

As it is, your question is not readable.

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

I don't know what you did with your indentation, but yaml require correct indentation, and what you just posted won't work as valid yaml.

I do believe you should try to put some effort into asking high quality questions if you want to get high quality answers.

As it is, I'm just going to recommend GitHub - taiki-e/upload-rust-binary-action: GitHub Action for building and uploading Rust binary to GitHub Releases.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.