-
-
Notifications
You must be signed in to change notification settings - Fork 18
100 lines (84 loc) · 2.93 KB
/
wolfdisk-release.yml
File metadata and controls
100 lines (84 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: WolfDisk — Build Release Binaries
on:
push:
branches: [main]
paths:
- 'wolfdisk/Cargo.toml'
- 'wolfdisk/src/**'
- 'wolfdisk/Cross.toml'
- '.github/workflows/wolfdisk-release.yml'
workflow_dispatch:
defaults:
run:
working-directory: wolfdisk
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
arch: x86_64
runner: ubuntu-latest
- target: aarch64-unknown-linux-musl
arch: aarch64
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
working-directory: .
- name: Build static binaries
run: cross build --release --target ${{ matrix.target }}
- name: Get version
id: version
run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> "$GITHUB_OUTPUT"
- name: Package binaries
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/wolfdisk dist/wolfdisk-${{ matrix.arch }}
cp target/${{ matrix.target }}/release/wolfdiskctl dist/wolfdiskctl-${{ matrix.arch }}
chmod +x dist/wolfdisk-${{ matrix.arch }}
chmod +x dist/wolfdiskctl-${{ matrix.arch }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wolfdisk-${{ matrix.arch }}
path: wolfdisk/dist/*
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> "$GITHUB_OUTPUT"
working-directory: wolfdisk
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create or update release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="v${{ steps.version.outputs.version }}-wolfdisk"
# Delete existing release if it exists (update scenario)
gh release delete "$VERSION" --yes 2>/dev/null || true
git push --delete origin "$VERSION" 2>/dev/null || true
# Create release with binaries
gh release create "$VERSION" \
--title "WolfDisk ${{ steps.version.outputs.version }}" \
--notes "Prebuilt static binaries for Linux x86_64 and aarch64 (ARM64/Raspberry Pi 4+)." \
dist/wolfdisk-x86_64 \
dist/wolfdisk-aarch64 \
dist/wolfdiskctl-x86_64 \
dist/wolfdiskctl-aarch64
working-directory: .