pipeline: update build.yml dependencies, fix missing artifact #152
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
configuration: [Release_AVX, Release_G1_AVX, Release, Release_G1, Spacer_NET, Launcher] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
- name: Set tag and directory name env | |
run: | | |
$shortHash = $Env:GITHUB_SHA.Substring(0, 9) | |
echo (-join("CL=/DVERSION_NUMBER#",'\"',"-git-${shortHash}",'\"')) >> $Env:GITHUB_ENV | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: nuget restore . | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /p:Configuration=${{matrix.configuration}} . | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.configuration }} | |
path: ${{ matrix.configuration }}/ddraw.dll | |
retention-days: 2 | |
artifacts: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set tag and directory name env | |
run: | | |
$tagName = $Env:GITHUB_SHA.Substring(0, 9) | |
$dirName = "GD3D11-git-$tagName" | |
echo "Tag: ${tagName}" | |
echo "Directory: ${dirName}" | |
echo "RELEASE_VERSION=${tagName}" >> $Env:GITHUB_ENV | |
echo "RELEASE_DIR=${dirName}" >> $Env:GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: tree | |
- name: Create distribution | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
mkdir "${{env.RELEASE_DIR}}\GD3D11\shaders\CSFFT" -Force | |
mkdir "${{env.RELEASE_DIR}}\GD3D11\Bin" -Force | |
Xcopy "D3D11Engine\Shaders\*" "${{env.RELEASE_DIR}}\GD3D11\shaders" /s | |
copy "D3D11Engine\CSFFT\*.hlsl" "${{env.RELEASE_DIR}}\GD3D11\shaders\CSFFT" | |
Xcopy "blobs\Meshes" "${{env.RELEASE_DIR}}\GD3D11\Meshes\" /s | |
Xcopy "blobs\Textures" "${{env.RELEASE_DIR}}\GD3D11\Textures\" /s | |
Xcopy "blobs\libs\*" "${{env.RELEASE_DIR}}\" /s | |
copy "Release_AVX\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g2a_avx2.dll" | |
copy "Release\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g2a.dll" | |
copy "Release_G1_AVX\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g1_avx.dll" | |
copy "Release_G1\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g1.dll" | |
copy "Launcher\ddraw.dll" "${{env.RELEASE_DIR}}\" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RELEASE_DIR }} | |
path: ${{ env.RELEASE_DIR }} | |
# higher values don't get us much due to DLLs, libs, textures... | |
compression-level: 1 | |
- name: zip distribution for nightly | |
if: github.ref_name == 'master' | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
cd "${{env.RELEASE_DIR}}" | |
7z a -tzip "..\${{env.RELEASE_DIR}}.zip" -r | |
- name: Calculate distribution zip hash | |
if: github.ref_name == 'master' | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
(Get-FileHash "${{env.RELEASE_DIR}}.zip" -Algorithm SHA256).hash | Out-File -FilePath "${{env.RELEASE_DIR}}.zip.sha256" | |
type "${{env.RELEASE_DIR}}.zip.sha256" | |
- name: Delete old nightly | |
if: github.ref_name == 'master' | |
# v1.0.1 | |
uses: dev-drprasad/delete-tag-and-release@8cd619d00037e4aeb781909c9a6b03940507d0da | |
with: | |
delete_release: true | |
tag_name: nightly | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create new nightly | |
if: github.ref_name == 'master' | |
# v1.13.0 | |
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 | |
with: | |
name: Nightly | |
generateReleaseNotes: true | |
prerelease: true | |
draft: false | |
omitDraftDuringUpdate: true | |
artifacts: "${{env.RELEASE_DIR}}.zip,${{env.RELEASE_DIR}}.zip.sha256" | |
tag: nightly | |
token: ${{ secrets.GITHUB_TOKEN }} |