Update version #54
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@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" | |
mkdir "${{env.RELEASE_DIR}}\GD3D11\Bin" | |
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: Create nightly github release | |
if: github.ref_name == 'master' | |
run: | | |
gh release delete nightly --yes --cleanup-tag | |
gh release create nightly --prerelease --title "Nightly" --notes "Generated release from GitHub Actions" | |
echo "Ignore 'Validation Failed' results. Expected since only the first job that reaches this step can create the release." | |
exit 0 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Upload artifacts to github release | |
if: github.ref_name == 'master' | |
run: | | |
gh release upload nightly "${{env.RELEASE_DIR}}.zip" --clobber | |
gh release upload nightly "${{env.RELEASE_DIR}}.zip.sha256" --clobber | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |