Windows, how to use environment variable?
This action fails while the env var seems to be set allright. Is that because the env var is only set in git bash and I'm not using that?
https://github.com/ninovanhooff/LibHEBitmap/actions/runs/8930413593/job/24530460948
Relevant CmakeLists.txt error: https://github.com/ninovanhooff/LibHEBitmap/blob/3df3c67818640d6004d43bd098fe2ed96ccc6552/CMakeLists.txt#L20
My workflow: https://github.com/ninovanhooff/LibHEBitmap/actions/runs/8930413593/workflow
Hi @ninovanhooff 👋 We're using bash everywhere. There is real usage example.
You're right, env var PLAYDATE_SDK_PATH is set from bash but should be set not only for bash.
If you want it in another shel such as powershell or cmd, you can get the path of SDK from action' outputs, like this:
- id: sdk
uses: # this action
...
# You can use ${{ steps.sdk.outputs.root }} or ${{ env.PLAYDATE_SDK_PATH }}.
# This is for pwsh:
- run: echo "PLAYDATE_SDK_PATH=${{ steps.sdk.outputs.root }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
Or for your case, I could try to add there and there env var via GitHub's api:
- name: Configure CMake
env: # this 👇
PLAYDATE_SDK_PATH: ${{ steps.sdk.outputs.root }}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
...
I didn't tested this way, but supposed to work according to GH's docs.
Anyway, that's strange, IMHO, because I writing env in normal way that recommended by GH (1, 2, 3).
That is strange, I see that env already set in your workflow. See this linux win lines.
And on linux CMake wants you to set env var CMAKE_MAKE_PROGRAM there.
Seems to paths in env are not UNC or old win format, so pwsh breaks on them.
fixed in https://github.com/pd-rs/get-playdate-sdk/pull/35
Thank you very much, my build is fixed!