- Home /
Setting path for CI/CD in Github
Hello,
I am trying to setup Github workflow for my project. I am using game.ci to automatically build the project for me on pushing to main branch. Here is the code I am using (which I directly copied from document):
name: Build project
on: [push]
jobs:
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows64 # Build a Windows 64-bit standalone.
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
On execution it fails to find the Library directory for caching. I think the problem here is that my project has a different hierarchy
- MyProjectName
- .github
- MyProjectName
- Assets
- Library
- ProjectSettings
- etc.
and the sample code is expecting
- MyProjectName
- .github
- Assets
- Library
- ProjectSettings
- etc.
So how do I modify the path in order to link to the correct folder? I reckon this is simply a relative path problem, but I couldn't make it work.
Thanks in advance!!!
Answer by GabLeRoux · Nov 12, 2021 at 03:44 PM
Hi, we have projectPath
configuration option that can be used specifically for this use case:
https://game.ci/docs/github/builder#projectpath
The advanced example on the following page has a usage example of it:
https://game.ci/docs/github/getting-started#advanced-example
In your case, the file you provided would be updated to this:
name: Build project
on: [push]
jobs:
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows64 # Build a Windows 64-bit standalone.
projectPath:
- MyProjectName # ** this is what you're looking for **
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
Feel free to join our discord server or post issues on related github repositories. You might have more chances of getting quick answers. :)