Skip to content

Merge pull request #129 from tzarchat/master #56

Merge pull request #129 from tzarchat/master

Merge pull request #129 from tzarchat/master #56

Workflow file for this run

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@v3
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- 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@v3
with:
name: ${{ matrix.configuration }}
path: ${{ matrix.configuration }}/ddraw.dll
retention-days: 2
artifacts:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- 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@v3
- name: Display structure of downloaded files
run: ls -R
- 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@v3
with:
name: ${{ env.RELEASE_DIR }}
path: ${{ env.RELEASE_DIR }}
- 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'
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create new nightly
uses: ncipollo/release-action@v1
with:
name: Nightly
generateReleaseNotes: true
prerelease: true
artifacts: "${{env.RELEASE_DIR}}.zip,{{env.RELEASE_DIR}}.zip.sha256"
tag: nightly
token: ${{ secrets.GITHUB_TOKEN }}