1818jobs :
1919 build-linux :
2020 runs-on : ubuntu-latest
21+ outputs :
22+ artifact_path : ${{ steps.set-outputs.outputs.artifact_path }}
23+ arch : ${{ steps.set-outputs.outputs.arch }}
24+ env :
25+ ARCH :
26+ ${{ github.event.inputs.linux_arch || 'linux-x64' }}
2127 steps :
2228 - name : Checkout Code
2329 uses : actions/checkout@v4
24- with :
25- fetch-depth : 0
2630
27- - name : Make Build Script Executable
28- run : chmod +x Scripts/build.sh
31+ - name : Run Build Script
32+ run : |
33+ chmod +x Scripts/build.sh
34+ cd Scripts && ./build.sh ${{ env.ARCH }}
35+
36+ - name : Rename Output Folder
37+ run : |
38+ mkdir -p dist/ASVLM-${{ env.ARCH }}
39+ cp -r ASVLM.Desktop/release_${{ env.ARCH }}/* dist/ASVLM-${{ env.ARCH }}/
2940
30- - name : Build for Linux
31- run : ./Scripts/build.sh ${{ github.event.inputs.linux_arch }}
41+ - name : Archive for Upload
42+ run : zip -r ASVLM-${{ env.ARCH }}.zip dist/ASVLM- ${{ env.ARCH }}
3243
3344 - name : Upload Linux Artifacts
45+ if : github.event_name == 'workflow_dispatch'
3446 uses : actions/upload-artifact@v4
3547 with :
3648 name : linux-artifacts
37- path : ./Artifacts/**
49+ path : ASVLM-${{ env.ARCH }}.zip
50+
51+ - name : Set Output Path
52+ id : set-outputs
53+ run : |
54+ echo "artifact_path=$(pwd)/ASVLM-${{ env.ARCH }}.zip" >> $GITHUB_OUTPUT
55+ echo "arch=${{ env.ARCH }}" >> $GITHUB_OUTPUT
3856
3957 build-windows :
4058 runs-on : windows-latest
59+ outputs :
60+ artifact_path : ${{ steps.set-outputs.outputs.artifact_path }}
61+ arch : ${{ steps.set-outputs.outputs.arch }}
62+ env :
63+ ARCH : ${{ github.event.inputs.windows_arch || 'win-x64' }}
4164 steps :
4265 - name : Checkout Code
4366 uses : actions/checkout@v4
44- with :
45- fetch-depth : 0
4667
47- - name : Make Build Script Executable (WSL)
48- run : wsl chmod +x Scripts/build.sh
68+ - name : Copy & Make Executable in WSL
69+ run : |
70+ wsl mkdir -p /tmp/scripts
71+ wsl cp "/mnt/c/${{ github.workspace }}/Scripts/build.sh" /tmp/scripts/build.sh
72+ wsl chmod +x /tmp/scripts/build.sh
4973
50- - name : Build for Windows ( WSL)
51- run : wsl ./Scripts/ build.sh ${{ github.event.inputs.windows_arch }}
74+ - name : Build Project via WSL
75+ run : wsl /tmp/scripts/ build.sh " ${{ env.ARCH }}"
5276
53- - name : Upload Windows Artifacts
77+ - name : Rename Output Folder
78+ run : |
79+ mkdir -p dist/ASVLM-${{ env.ARCH }}
80+ robocopy "ASVLM.Desktop\release_${{ env.ARCH }}" "dist/ASVLM-${{ env.ARCH }}" /E /NFL /NDL /NJH /NJS /NP
81+ # Fallback if robocopy fails
82+ New-Item -ItemType Directory -Path dist -ErrorAction Ignore
83+
84+ - name : Archive for Upload
85+ run : |
86+ Compress-Archive -Path "dist/ASVLM-${{ env.ARCH }}/*" -DestinationPath "ASVLM-${{ env.ARCH }}.zip" -Force
87+
88+ - name : Upload Artifact (Manual Run)
89+ if : github.event_name == 'workflow_dispatch'
5490 uses : actions/upload-artifact@v4
5591 with :
56- name : windows-artifacts
57- path : ./Artifacts/**
92+ name : windows-artifact
93+ path : ASVLM-${{ env.ARCH }}.zip
94+
95+ - name : Set Output Path and Arch
96+ id : set-outputs
97+ run : |
98+ echo "artifact_path=$(Get-Location)/ASVLM-${{ env.ARCH }}.zip" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
99+ echo "arch=${{ env.ARCH }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
100+
101+ create-release :
102+ needs : [build-linux, build-windows]
103+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
104+ runs-on : ubuntu-latest
105+ permissions :
106+ contents : write
107+ steps :
108+ - name : Get Tag Name
109+ id : get-tag
110+ run : |
111+ echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
112+
113+ - name : Create Release
114+ id : create_release
115+ uses : actions/create-release@v1
116+ env :
117+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118+ with :
119+ tag_name : ${{ steps.get-tag.outputs.tag }}
120+ release_name : Release ${{ steps.get-tag.outputs.tag }}
121+ draft : false
122+ prerelease : false
123+
124+ - name : Upload Linux Asset
125+ uses : actions/upload-release-asset@v1
126+ env :
127+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128+ with :
129+ upload_url : ${{ steps.create_release.outputs.upload_url }}
130+ asset_path : ${{ needs.build-linux.outputs.artifact_path }}
131+ asset_name : ASVLM-${{ needs.build-linux.outputs.arch }}-linux.zip
132+ asset_content_type : application/zip
133+
134+ - name : Upload Windows Asset
135+ uses : actions/upload-release-asset@v1
136+ env :
137+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
138+ with :
139+ upload_url : ${{ steps.create_release.outputs.upload_url }}
140+ asset_path : ${{ needs.build-windows.outputs.artifact_path }}
141+ asset_name : ASVLM-${{ needs.build-windows.outputs.arch }}-win.zip
142+ asset_content_type : application/zip
0 commit comments