Skip to content

Commit e387660

Browse files
committed
多二进制支持
1 parent f4f549a commit e387660

File tree

7 files changed

+59
-23
lines changed

7 files changed

+59
-23
lines changed

.github/workflows/rust.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ on:
88

99
jobs:
1010
build:
11-
name: build on ${{ matrix.os }}
11+
name: build ${{ matrix.file }} on ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
include:
16-
- os: windows-latest
17-
file: target/release/${{ github.event.repository.name }}.exe
18-
- os: ubuntu-latest
19-
file: target/release/${{ github.event.repository.name }}
15+
os:
16+
- windows-latest
17+
- ubuntu-latest
18+
file:
19+
# - ${{ github.event.repository.name }}
20+
- bin1
21+
- bin2
2022
runs-on: ${{ matrix.os }}
2123
# outputs:
2224
# artifact-url: ${{ steps.artifact-upload-step.outputs.artifact-url }}
@@ -30,27 +32,31 @@ jobs:
3032
uses: actions/upload-artifact@master
3133
id: artifact-upload-step
3234
with:
33-
name: Binary-${{ matrix.os }}
34-
path: ${{ matrix.file }}
35+
name: Binary-${{ matrix.file }}-${{ matrix.os }}
36+
path: target/release/${{ matrix.file }}${{ runner.os == 'Windows' && '.exe' || '' }}
3537
# - name: Output artifact URL
3638
# run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
3739

3840
release:
39-
name: downloading Binary-${{ matrix.os }}
41+
name: downloading Binary-${{ matrix.file }}-${{ matrix.os }}
4042
strategy:
4143
fail-fast: false
4244
matrix:
43-
include:
44-
- os: windows-latest
45-
- os: ubuntu-latest
45+
os:
46+
- windows-latest
47+
- ubuntu-latest
48+
file:
49+
# - ${{ github.event.repository.name }}
50+
- bin1
51+
- bin2
4652
runs-on: ubuntu-latest
4753
needs: build
4854
permissions:
4955
contents: write
5056
steps:
5157
- uses: actions/download-artifact@master
5258
with:
53-
name: Binary-${{ matrix.os }}
59+
name: Binary-${{ matrix.file }}-${{ matrix.os }}
5460
- name: List files
5561
run: |
5662
ls -lih
@@ -59,5 +65,7 @@ jobs:
5965
if: startsWith(github.ref, 'refs/tags/')
6066
with:
6167
token: ${{ secrets.GITHUB_TOKEN }}
62-
files: |
63-
${{ github.event.repository.name }}*
68+
files: '*'
69+
- name: Done
70+
run: |
71+
echo "### [${{ github.ref_name }}](https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ github.ref_name }}) Released! :rocket:" >> $GITHUB_STEP_SUMMARY

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
[package]
2-
name = "hi-rust-release"
3-
version = "0.1.0"
4-
edition = "2021"
5-
6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
8-
[dependencies]
1+
[workspace]
2+
resolver = "2"
3+
members = [
4+
"bin1",
5+
"bin2",
6+
]

bin1/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "bin1"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
File renamed without changes.

bin2/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "bin2"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

bin2/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

0 commit comments

Comments
 (0)