Skip to content

Commit 0ab6cd4

Browse files
authored
Create release.yml
1 parent 8d19d7e commit 0ab6cd4

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release
2+
3+
# Uruchamiane na tag w formacie v<wersja> (np. v1.2) - MUSI byc zgodne z
4+
# `using <wersja>` w Virus.hk i z adresem URL w
5+
# virus/cli/src/hackerc_bridge.rs (release_url/asset_name).
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
jobs:
12+
build-hackerc:
13+
name: hackerc binarka (${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
asset_name: hackerc-linux-x86_64
21+
- os: macos-latest
22+
asset_name: hackerc-macos-x86_64
23+
- os: windows-latest
24+
asset_name: hackerc-windows-x86_64.exe
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
- name: Zainstaluj hackerc + PyInstaller
31+
run: |
32+
pip install -e ./hackerc
33+
pip install pyinstaller
34+
- name: Zbuduj samodzielna binarke (bez wymaganego interpretera obok)
35+
working-directory: hackerc
36+
run: |
37+
pyinstaller --onefile --name hackerc-bin entrypoint.py
38+
- name: Zmien nazwe assetu
39+
shell: bash
40+
run: |
41+
mkdir -p dist_final
42+
if [ "${{ runner.os }}" = "Windows" ]; then
43+
cp hackerc/dist/hackerc-bin.exe "dist_final/${{ matrix.asset_name }}"
44+
else
45+
cp hackerc/dist/hackerc-bin "dist_final/${{ matrix.asset_name }}"
46+
fi
47+
- uses: actions/upload-artifact@v4
48+
with:
49+
name: ${{ matrix.asset_name }}
50+
path: dist_final/${{ matrix.asset_name }}
51+
52+
build-virus:
53+
name: virus binarka (${{ matrix.os }})
54+
runs-on: ${{ matrix.os }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
include:
59+
- os: ubuntu-latest
60+
asset_name: virus-linux-x86_64
61+
- os: macos-latest
62+
asset_name: virus-macos-x86_64
63+
- os: windows-latest
64+
asset_name: virus-windows-x86_64.exe
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: dtolnay/rust-toolchain@stable
68+
- uses: Swatinem/rust-cache@v2
69+
with:
70+
workspaces: virus
71+
- name: cargo build --release
72+
working-directory: virus
73+
run: cargo build --release -p virus
74+
- name: Zmien nazwe assetu
75+
shell: bash
76+
run: |
77+
mkdir -p dist_final
78+
if [ "${{ runner.os }}" = "Windows" ]; then
79+
cp virus/target/release/virus.exe "dist_final/${{ matrix.asset_name }}"
80+
else
81+
cp virus/target/release/virus "dist_final/${{ matrix.asset_name }}"
82+
fi
83+
- uses: actions/upload-artifact@v4
84+
with:
85+
name: ${{ matrix.asset_name }}
86+
path: dist_final/${{ matrix.asset_name }}
87+
88+
publish:
89+
name: Publikuj GitHub Release
90+
needs: [build-hackerc, build-virus]
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/download-artifact@v4
94+
with:
95+
path: artifacts
96+
merge-multiple: true
97+
- name: Lista pobranych artefaktow
98+
run: ls -la artifacts
99+
- uses: softprops/action-gh-release@v2
100+
with:
101+
files: artifacts/*
102+
generate_release_notes: true

0 commit comments

Comments
 (0)