Skip to content

Commit e686129

Browse files
authored
Add automated release workflow
1 parent 53af70f commit e686129

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Deploy Release
2+
3+
# Uruchom tylko, gdy wypchnięty zostanie tag zaczynający się od 'v' (np. v0.1.3)
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-and-upload:
14+
name: Build ${{ matrix.target }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
# --- WINDOWS ---
21+
- target: x86_64-pc-windows-msvc
22+
os: windows-latest
23+
output_name: cargo-plot-fs-tree-win64.exe
24+
25+
- target: i686-pc-windows-msvc
26+
os: windows-latest
27+
output_name: cargo-plot-fs-tree-win32.exe
28+
29+
# Opcjonalnie: Windows ARM (Surface Pro X/11 itp.)
30+
# - target: aarch64-pc-windows-msvc
31+
# os: windows-latest
32+
# output_name: cargo-plot-fs-tree-win-arm64.exe
33+
34+
# --- LINUX ---
35+
# 64-bit: Używamy MUSL dla pełnej przenośności (działa na Alpine, Debian, Ubuntu)
36+
- target: x86_64-unknown-linux-musl
37+
os: ubuntu-latest
38+
output_name: cargo-plot-fs-tree-linux64
39+
use_musl: true
40+
41+
# 32-bit: Używamy GNU (łatwiejsze do zbudowania na GitHub Actions bez Dockera)
42+
- target: i686-unknown-linux-gnu
43+
os: ubuntu-latest
44+
output_name: cargo-plot-fs-tree-linux32
45+
install_multilib: true
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
# Aktualizacja Rusta
51+
- name: Install Rust
52+
run: rustup update stable && rustup target add ${{ matrix.target }}
53+
54+
# Zależności dla Linuxa (tylko jeśli system to Linux)
55+
- name: Install Linux Deps
56+
if: runner.os == 'Linux'
57+
run: |
58+
sudo apt-get update
59+
# Podstawowe narzędzia
60+
sudo apt-get install -y build-essential
61+
62+
# Specyficzne dla Linux 32-bit (gcc-multilib pozwala kompilować 32bit na 64bit maszynie)
63+
- name: Install Multilib (Linux 32-bit)
64+
if: matrix.install_multilib == true
65+
run: sudo apt-get install -y gcc-multilib
66+
67+
# Specyficzne dla Linux MUSL 64-bit
68+
- name: Install MUSL Tools
69+
if: matrix.use_musl == true
70+
run: sudo apt-get install -y musl-tools
71+
72+
# Budowanie (Release) dla konkretnego targetu
73+
- name: Build
74+
run: cargo build --release --target ${{ matrix.target }} --verbose
75+
76+
# Przygotowanie pliku do wysyłki (Zmieniamy nazwę na czytelną)
77+
- name: Rename Artifact (Windows)
78+
if: runner.os == 'Windows'
79+
run: copy target/${{ matrix.target }}/release/cargo-plot-fs-tree.exe ${{ matrix.output_name }}
80+
81+
- name: Rename Artifact (Linux)
82+
if: runner.os == 'Linux'
83+
run: cp target/${{ matrix.target }}/release/cargo-plot-fs-tree ${{ matrix.output_name }}
84+
85+
# --- AUTOMATYCZNA PUBLIKACJA NA GITHUB RELEASES ---
86+
- name: Release
87+
uses: softprops/action-gh-release@v1
88+
with:
89+
files: ${{ matrix.output_name }}
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)