-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.14 KB
/
release.yml
File metadata and controls
84 lines (69 loc) · 2.14 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "要发布的 Tag(例如 v0.2.9)"
required: false
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_RELEASE_DEBUG: 0
RUSTFLAGS: "-C target-feature=+crt-static"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: x86_64-unknown-linux-musl
- name: Install musl tools
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- name: Build
env:
CC: musl-gcc
run: |
RUSTC_WRAPPER="" cargo build \
--release \
--target x86_64-unknown-linux-musl
- name: Strip binary
run: |
strip target/x86_64-unknown-linux-musl/release/floatctf
- name: Verify static binary
run: |
file target/x86_64-unknown-linux-musl/release/floatctf
ldd target/x86_64-unknown-linux-musl/release/floatctf || true
# =========================
# 核心修改点:在这里将 src/sql 目录打包并放入 dist
# =========================
- name: Prepare artifact
run: |
mkdir -p dist
# 1. 复制二进制文件
cp target/x86_64-unknown-linux-musl/release/floatctf \
dist/floatctf-linux-amd64-musl
# 2. 将 src/sql 目录打包成 sql.tar.gz,并放入 dist 目录
tar -czf dist/sql.tar.gz src/sql
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
generate_release_notes: true
# 因为上面把 sql.tar.gz 放进了 dist 里面,所以这里的 dist/* 会自动把它一起传上去
files: dist/*