1
- name : Publish to crate.io
1
+ name : Publish to crate.io and GitHub Release
2
2
3
3
on :
4
4
workflow_call :
8
8
type : string
9
9
10
10
jobs :
11
+ build :
12
+ strategy :
13
+ matrix :
14
+ os : [ubuntu-latest, windows-latest, macos-latest]
15
+ runs-on : ${{ matrix.os }}
16
+ steps :
17
+ - uses : actions/checkout@v4
18
+ - name : Install Rust Toolchain
19
+ uses : actions-rs/toolchain@v1
20
+ with :
21
+ toolchain : stable
22
+ - name : Build Binary
23
+ run : cargo build --release
24
+ - name : Upload Binary
25
+ uses : actions/upload-artifact@v3
26
+ with :
27
+ name : binary-${{ matrix.os }}
28
+ path : target/release/${{ github.event.repository.name }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
29
+
11
30
publish :
31
+ needs : build
12
32
runs-on : ubuntu-latest
13
33
steps :
14
34
- uses : actions/checkout@v4
@@ -28,16 +48,20 @@ jobs:
28
48
run : |
29
49
cargo login ${CARGO_REGISTRY_TOKEN}
30
50
cargo publish
31
- - name : Create Git Tag
51
+ - name : Download Binaries
52
+ uses : actions/download-artifact@v3
53
+ - name : Rename Binaries
32
54
run : |
33
- git config user.name github-actions
34
- git config user.email [email protected]
35
- git tag -a v${{ inputs.version }} -m "Release ${{ inputs.version }}"
36
- git push origin v${{ inputs.version }}
55
+ mv binary-ubuntu-latest/${{ github.event.repository.name }} ${{ github.event.repository.name }}-linux
56
+ mv binary-windows-latest/${{ github.event.repository.name }}.exe ${{ github.event.repository.name }}-windows.exe
57
+ mv binary-macos-latest/${{ github.event.repository.name }} ${{ github.event.repository.name }}-macos
37
58
- name : Create GitHub Release
38
59
env :
39
60
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40
61
run : |
41
62
gh release create v${{ inputs.version }} \
42
63
--title "Release ${{ inputs.version }}" \
43
- --generate-notes
64
+ --generate-notes \
65
+ ${{ github.event.repository.name }}-linux \
66
+ ${{ github.event.repository.name }}-windows.exe \
67
+ ${{ github.event.repository.name }}-macos
0 commit comments