This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Make game bootup? #348
This file contains hidden or 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 Build | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Windows Build | |
permissions: write-all | |
runs-on: windows-latest | |
steps: | |
- name: Pulling the new commit | |
uses: actions/checkout@v3 | |
- name: Setting up Haxe | |
uses: krdlab/setup-haxe@v1 | |
with: | |
haxe-version: 4.2.5 | |
- name: Get Libs Hash | |
id: get_hash | |
shell: pwsh | |
run: | | |
$env:GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" | |
$hash = haxe -cp commandline -D analyzer-optimize --run Main get-libs-hash | |
"hash=$hash" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Restore existing build cache for faster compilation | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
# not caching the bin folder to prevent asset duplication and stuff like that | |
key: cache-build-windows-${{ steps.get_hash.outputs.hash }} | |
path: | | |
.haxelib/ | |
~/.hxcpp/ | |
export/release/windows/haxe/ | |
export/release/windows/obj/ | |
restore-keys: | | |
cache-build-windows-${{ steps.get_hash.outputs.hash }} | |
- name: Enable HXCPP compile cache | |
run: | | |
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV | |
- name: Installing/Updating libraries | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
haxe -cp commandline -D analyzer-optimize --run Main setup -s --actions | |
- name: Building HXCPP | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
haxelib dev hxcpp .haxelib/hxcpp/git | |
cd .haxelib/hxcpp/git/tools/hxcpp | |
haxe compile.hxml | |
cd ../../../../.. | |
- name: Building Lime | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
haxelib dev lime .haxelib/lime/git | |
haxelib run lime setup -alias -y -nocffi -eval | |
haxelib run lime rebuild windows -release -nocolor -eval | |
cd .haxelib/lime/git/tools | |
haxe tools.hxml | |
cd ../../../.. | |
- name: Building the game | |
run: | | |
haxelib run lime build windows | |
- name: Uploading artifact (entire build) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Codename Engine | |
path: export/release/windows/bin | |
# - name: Uploading artifact (executable) | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: Update-Windows | |
# path: export/release/windows/bin/CodenameEngine.exe | |
- name: Clearing already existing cache | |
uses: actions/github-script@v6 | |
env: | |
HASH: ${{ steps.get_hash.outputs.hash }} | |
with: | |
script: | | |
const hash = process.env.HASH; | |
const caches = await github.rest.actions.getActionsCacheList({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
for (const cache of caches.data.actions_caches) { | |
if (cache.key == "cache-build-windows-" + hash) { | |
console.log('Clearing ' + cache.key + '...'); | |
await github.rest.actions.deleteActionsCacheById({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
cache_id: cache.id, | |
}); | |
console.log("Cache cleared."); | |
} | |
} | |
- name: Uploading new cache | |
uses: actions/cache@v3 | |
with: | |
# caching again since for some reason it doesnt work with the first post cache shit | |
key: cache-build-windows-${{ steps.get_hash.outputs.hash }} | |
path: | | |
.haxelib/ | |
~/.hxcpp/ | |
export/release/windows/haxe/ | |
export/release/windows/obj/ | |
restore-keys: | | |
cache-build-windows-${{ steps.get_hash.outputs.hash }} |