-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (84 loc) · 3.13 KB
/
rust.yml
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
101
102
103
104
105
name: Rust -> Build & Test & Release
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
GENERIC_BINARY_NAME: rust-tcp-file-transfer
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload Linux Binary
uses: actions/upload-artifact@v3
with:
name: $(GENERIC_BINARY_NAME)-linux-x64_86
path: target/release/*transfer
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --release --verbose
# - name: Run tests
# run: cargo test --verbose
# - name: Upload Windows Binary
# uses: actions/upload-artifact@v3
# with:
# name: $(GENERIC_BINARY_NAME)-windows-x64_86
# path: target/release/*transfer.exe
build_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload MacOS Binary
uses: actions/upload-artifact@v3
with:
name: $(GENERIC_BINARY_NAME)-macos-x64_86
path: target/release/*transfer
release:
needs: [build_linux, build_windows, build_macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Forge a Folder
run: |
echo "$GENERIC_BINARY_NAME"
tree
mkdir Downloads
working-directory: /home/runner/work/$(GENERIC_BINARY_NAME)/$(GENERIC_BINARY_NAME)/
- uses: actions/download-artifact@v3
name: Download
with:
path: Downloads/
- name: Rename Binaries
run: |
tree Downloads/
mv Downloads/$(GENERIC_BINARY_NAME)-linux-x64_86/$(GENERIC_BINARY_NAME) Downloads/$(GENERIC_BINARY_NAME)-linux-x64_86/$(GENERIC_BINARY_NAME)-linux-x64_86
mv Downloads/$(GENERIC_BINARY_NAME)-windows-x64_86/$(GENERIC_BINARY_NAME).exe Downloads/$(GENERIC_BINARY_NAME)-windows-x64_86/$(GENERIC_BINARY_NAME)-windows-x64_86.exe
mv Downloads/$(GENERIC_BINARY_NAME)-macos-x64_86/$(GENERIC_BINARY_NAME) Downloads/$(GENERIC_BINARY_NAME)-macos-x64_86/$(GENERIC_BINARY_NAME)-macos-x64_86
- name: Git Commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
- uses: softprops/[email protected]
name: Release
with:
tag_name: ${{ steps.vars.outputs.short_sha }}
generate_release_notes: true
files: |
Downloads/$(GENERIC_BINARY_NAME)-linux-x64_86/$(GENERIC_BINARY_NAME)
Downloads/$(GENERIC_BINARY_NAME)-windows-x64_86/$(GENERIC_BINARY_NAME).exe
Downloads/$(GENERIC_BINARY_NAME)-macos-x64_86/$(GENERIC_BINARY_NAME)