1- name : Build and Release
1+ name : Build
22
33on :
4- workflow_dispatch :
54 push :
6- branches : [ main ]
5+ branches : [main]
6+ pull_request :
7+ workflow_dispatch :
78
89env :
910 CARGO_TERM_COLOR : always
@@ -17,67 +18,45 @@ jobs:
1718 strategy :
1819 matrix :
1920 target : [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
20- steps :
21- - uses : actions/checkout@v4
22-
23- - name : Install Rust
24- uses : actions-rs/toolchain@v1
25- with :
26- profile : minimal
27- toolchain : stable
28- target : ${{ matrix.target }}
29- override : true
30-
31- - name : Build for target
32- run : cargo build --release --target=${{ matrix.target }}
33-
34- - name : Rename DLLs
35- run : |
36- $target = "${{ matrix.target }}"
37- $originalPath = "target\$target\release\$env:PROJECT_NAME.dll"
3821
39- if ($target -eq "i686-pc-windows-msvc") {
40- $newPath = "target\$target\release\$env:NAME_WIN32"
41- } else {
42- $newPath = "target\$target\release\$env:NAME_WIN64"
43- }
44-
45- if (Test-Path $originalPath) {
46- Move-Item -Path $originalPath -Destination $newPath -Force
47- Write-Host "Renamed $originalPath to $newPath"
48- } else {
49- Write-Host "File not found: $originalPath"
50- exit 1
51- }
52- shell : pwsh
53-
54- - name : Upload artifacts
55- 56- with :
57- name : ${{ matrix.target }}-dll
58- path : target/${{ matrix.target }}/release/${{ matrix.target == 'i686-pc-windows-msvc' && env.NAME_WIN32 || env.NAME_WIN64 }}
59-
60- release :
61- needs : build
62- runs-on : ubuntu-latest
6322 steps :
64- - name : Download artifacts
65- 66- with :
67- path : artifacts
68-
69- - name : Get current date for CalVer
70- id : date
71- run : echo "version=$(date +'%Y.%-m.%-d')" >> $GITHUB_OUTPUT
72-
73- - name : Create tag and release
74- uses : softprops/action-gh-release@v1
75- with :
76- tag_name : v${{ steps.date.outputs.version }}
77- name : Release v${{ steps.date.outputs.version }}
78- body : " Automated release with 32-bit and 64-bit DLLs"
79- files : |
80- artifacts/i686-pc-windows-msvc-dll/${{ env.NAME_WIN32 }}
81- artifacts/x86_64-pc-windows-msvc-dll/${{ env.NAME_WIN64 }}
82- env :
83- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23+ - name : Checkout source
24+ uses : actions/checkout@v4
25+
26+ - name : Install Rust toolchain
27+ uses : actions-rs/toolchain@v1
28+ with :
29+ profile : minimal
30+ toolchain : stable
31+ target : ${{ matrix.target }}
32+ override : true
33+
34+ - name : Build for ${{ matrix.target }}
35+ run : cargo build --release --target=${{ matrix.target }}
36+
37+ - name : Rename output DLL
38+ run : |
39+ $target = "${{ matrix.target }}"
40+ $original = "target\$target\release\$env:PROJECT_NAME.dll"
41+
42+ if ($target -eq "i686-pc-windows-msvc") {
43+ $renamed = "target\$target\release\$env:NAME_WIN32"
44+ } else {
45+ $renamed = "target\$target\release\$env:NAME_WIN64"
46+ }
47+
48+ if (Test-Path $original) {
49+ Move-Item $original $renamed -Force
50+ Write-Host "Renamed $original to $renamed"
51+ } else {
52+ Write-Host "DLL not found: $original"
53+ exit 1
54+ }
55+ shell : pwsh
56+
57+ - name : Upload artifact
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : ${{ matrix.target }}-dll
61+ path : |
62+ target/${{ matrix.target }}/release/${{ matrix.target == 'i686-pc-windows-msvc' && env.NAME_WIN32 || env.NAME_WIN64 }}
0 commit comments