Skip to content

feat: rust ci to build binaries #4

feat: rust ci to build binaries

feat: rust ci to build binaries #4

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_suffix: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
binary_suffix: ".exe"
- os: macos-latest
target: x86_64-apple-darwin
binary_suffix: ""
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary
id: rename
shell: bash
run: |
BIN_NAME="mi-programa"
SRC="target/${{ matrix.target }}/release/${BIN_NAME}${{ matrix.binary_suffix }}"
DST="${BIN_NAME}-${{ matrix.target }}${{ matrix.binary_suffix }}"
mv "$SRC" "$DST"
echo "artifact=$DST" >> $GITHUB_OUTPUT # <-- GITHUB_OUTPUT en vez de GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.rename.outputs.artifact }}
path: ${{ steps.rename.outputs.artifact }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
stepcode-x86_64-unknown-linux-gnu
stepcode-x86_64-pc-windows-msvc.exe
stepcode-x86_64-apple-darwin