Update workflow.yml #2028
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: | |
paths-ignore: | |
- '**.md' | |
- 'funding.yml' | |
- '.gitignore' | |
- '.gitattributes' | |
- '.github/images' | |
- '.github/ISSUE_TEMPLATE' | |
- '**/*.hlsl' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
- 'funding.yml' | |
- '.gitignore' | |
- '.gitattributes' | |
- '.github/images' | |
- '.github/ISSUE_TEMPLATE' | |
- '**/*.hlsl' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- api: vulkan | |
configuration: Release | |
- api: vulkan | |
configuration: Debug | |
- api: d3d12 | |
configuration: Release | |
runs-on: "windows-latest" | |
env: | |
msbuild_path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install Python dependencies | |
run: python -m pip install requests tqdm | |
- name: Generate version | |
id: version | |
run: | | |
echo "version=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_ENV | |
echo "Generated version: ${{ env.version }}" | |
- name: Generate project files | |
shell: python | |
env: | |
API: ${{ matrix.api }} | |
run: | | |
import subprocess | |
import os | |
api = os.environ["API"] | |
subprocess.run(f"python generate_vs2022_{api}.py ci") | |
- name: Build | |
shell: cmd | |
run: '"%msbuild_path%\MSBuild.exe" /p:Platform=Windows /p:Configuration=${{ matrix.configuration }} /m spartan.sln' | |
- name: Create artifacts | |
if: github.event_name != 'pull_request' && matrix.api == 'vulkan' | |
shell: cmd | |
run: | | |
echo "Creating artifacts for ${{ matrix.api }} - ${{ matrix.configuration }}" | |
SET BUILD_NAME=spartan_${{ matrix.api }}_${{ matrix.configuration }}_${{ env.version }} | |
echo "Build name: %BUILD_NAME%" | |
build_scripts\7z.exe a -bb1 %BUILD_NAME%.7z .\binaries\7z.exe .\binaries\dxcompiler.dll .\binaries\download_assets.py .\binaries\file_utilities.py .\binaries\fmod.dll .\binaries\data .\binaries\spartan_${{ matrix.api }}_${{ matrix.configuration }}.exe | |
echo "::set-output name=artifact_name::%BUILD_NAME%.7z" | |
- name: Upload artifact | |
if: github.event_name != 'pull_request' && matrix.api == 'vulkan' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spartan_${{ matrix.api }}_${{ matrix.configuration }}_${{ env.version }} | |
path: ${{ steps.create-artifacts.outputs.artifact_name }} | |
release: | |
if: github.event_name != 'pull_request' | |
runs-on: "ubuntu-latest" | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download vulkan release build | |
uses: actions/download-artifact@v4 | |
with: | |
name: spartan_vulkan_Release_${{ env.version }} | |
path: spartan_vulkan_release.7z | |
- name: Download vulkan debug build | |
uses: actions/download-artifact@v4 | |
with: | |
name: spartan_vulkan_Debug_${{ env.version }} | |
path: spartan_vulkan_debug.7z | |
- name: Publish release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.version }}" | |
prerelease: true | |
title: "Development Build v${{ env.version }}" | |
files: | | |
spartan_vulkan_release.7z | |
spartan_vulkan_debug.7z | |
- name: Set environment file for release | |
run: echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV |