Merge pull request #9 from furudbat/main #21
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: Windows | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'src/**' | |
- '.github/workflows/windows.yml' | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
permissions: | |
contents: write # for actions/upload-release-asset to upload release asset | |
runs-on: windows-latest | |
env: | |
PROJECT_NAME: raylib_game | |
PROJECT_REPO_NAME: ${{ github.event.repository.name }} | |
PROJECT_BUILD_PATH: "${{ github.event.repository.name }}\\projects\\VS2022\\build\\raylib_game\\bin\\x64\\Release" | |
PROJECT_RELEASE_PATH: ${{ github.event.repository.name }}_dev_win_x64 | |
PROJECT_RESOURCES_PATH: resources | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@master | |
with: | |
path: ${{ env.PROJECT_REPO_NAME }} | |
- name: Checkout raylib repo | |
uses: actions/checkout@v4 | |
with: | |
repository: raysan5/raylib | |
path: raylib | |
# NOTE: Visual Studio project build configuration already defines all required directories where project is generated: | |
# $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ | |
- name: Setup Release Paths | |
run: | | |
echo "PROJECT_RELEASE_PATH=${{ env.PROJECT_NAME }}_v${{ github.event.release.tag_name }}_win_x64" >> $GITHUB_ENV | |
shell: bash | |
if: github.event_name == 'release' && github.event.action == 'published' | |
- name: Setup Environment | |
run: | | |
mkdir ${{ env.PROJECT_RELEASE_PATH }} | |
dir | |
shell: cmd | |
# Setup MSBuild.exe path if required | |
- name: Setup MSBuild path | |
uses: microsoft/setup-msbuild@v2 | |
- name: Build raylib Library + Product (VS2022 solution) | |
run: | | |
dir | |
cd ${{ env.PROJECT_REPO_NAME }}/projects/VS2022 | |
msbuild.exe ${{ env.PROJECT_NAME }}.sln /target:${{ env.PROJECT_NAME }} /property:Configuration=Release /property:Platform=x64 /property:RaylibSrcPath="..\..\..\..\raylib\src" | |
cd ../.. | |
shell: cmd | |
- name: Generate Artifacts | |
run: | | |
dir ${{ env.PROJECT_BUILD_PATH }} | |
copy /Y ${{ env.PROJECT_BUILD_PATH }}\${{ env.PROJECT_NAME }}.exe ${{ env.PROJECT_RELEASE_PATH }}\${{ env.PROJECT_NAME }}.exe | |
xcopy ${{ env.PROJECT_REPO_NAME }}\src\${{ env.PROJECT_RESOURCES_PATH }} ${{ env.PROJECT_RELEASE_PATH }}\${{ env.PROJECT_RESOURCES_PATH }} /s /e /i | |
copy /Y ${{ env.PROJECT_REPO_NAME }}\README.md ${{ env.PROJECT_RELEASE_PATH }}\README.md | |
copy /Y ${{ env.PROJECT_REPO_NAME }}\LICENSE ${{ env.PROJECT_RELEASE_PATH }}\LICENSE | |
dir ${{ env.PROJECT_RELEASE_PATH }} | |
7z a .\${{ env.PROJECT_RELEASE_PATH }}.zip .\${{ env.PROJECT_RELEASE_PATH }} | |
shell: cmd | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
path: ./${{ env.PROJECT_RELEASE_PATH }}.zip | |
- name: Upload Artifact to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'release' && github.event.action == 'published' |