Skip to content

Commit 447b107

Browse files
committed
feat: rust ci to build binaries
1 parent 2f2be90 commit 447b107

1 file changed

Lines changed: 58 additions & 14 deletions

File tree

.github/workflows/release.yaml

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,74 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
7-
8-
permissions:
9-
contents: write
6+
- "v*.*.*"
107

118
jobs:
12-
release:
13-
runs-on: ubuntu-latest
9+
build:
10+
name: Build (${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-latest
16+
target: x86_64-unknown-linux-gnu
17+
binary_suffix: ""
18+
- os: windows-latest
19+
target: x86_64-pc-windows-msvc
20+
binary_suffix: ".exe"
21+
- os: macos-latest
22+
target: x86_64-apple-darwin
23+
binary_suffix: ""
24+
1425
steps:
15-
- name: Checkout repository
16-
uses: actions/checkout@v6
26+
- name: Checkout
27+
uses: actions/checkout@v4
1728

18-
- name: Install Nix
19-
uses: cachix/install-nix-action@v31
29+
- name: Install Rust
30+
uses: dtolnay/rust-toolchain@stable
2031
with:
21-
nix_path: nixpkgs=channel:nixos-25.11
32+
targets: ${{ matrix.target }}
2233

23-
- name: Build project
34+
- name: Cache
35+
uses: Swatinem/rust-cache@v2
36+
37+
- name: Build
38+
run: cargo build --release --target ${{ matrix.target }}
39+
40+
- name: Rename binary
41+
id: rename
42+
shell: bash
2443
run: |
25-
nix develop --command uv build
44+
BIN_NAME="mi-programa"
45+
SRC="target/${{ matrix.target }}/release/${BIN_NAME}${{ matrix.binary_suffix }}"
46+
DST="${BIN_NAME}-${{ matrix.target }}${{ matrix.binary_suffix }}"
47+
mv "$SRC" "$DST"
48+
echo "artifact=$DST" >> $GITHUB_OUTPUT # <-- GITHUB_OUTPUT en vez de GITHUB_ENV
49+
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: ${{ steps.rename.outputs.artifact }}
54+
path: ${{ steps.rename.outputs.artifact }}
55+
56+
release:
57+
name: Create Release
58+
needs: build
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: write
62+
63+
steps:
64+
- name: Download all artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
merge-multiple: true
2668

2769
- name: Create Release
2870
uses: softprops/action-gh-release@v2
2971
with:
3072
generate_release_notes: true
3173
files: |
32-
dist/stepcode-*
74+
stepcode-x86_64-unknown-linux-gnu
75+
stepcode-x86_64-pc-windows-msvc.exe
76+
stepcode-x86_64-apple-darwin

0 commit comments

Comments
 (0)