I want to run a .bat
file at the root of the repository, so I create a job to checkout the repo first, then try to find the file to run it in the second job. I thought this should be very simple, but I just can’t get it right… This is my YAML file.
name: MSBuild
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
SOLUTION_FILE_PATH: ./mysolution.sln
BUILD_CONFIGURATION: Release
permissions:
contents: read
jobs:
checkout:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
premake:
runs-on: windows-latest
needs: checkout
steps:
- working-directory: ${{env.GITHUB_WORKSPACE}}
run: ./premake.bat
build:
runs-on: windows-latest
needs: premake
steps:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Build Solution
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
Github keeps telling me that the “path is incorrect” or “no such file” or “premake.bat is not recognized as a name of …”, I thought ${{env.GITHUB_WORKSPACE}}
is my current working directory, but it is not, I also tried to print out ${{env.GITHUB_WORKSPACE}}
and .\
, but the ls -a
command always returns empty on both powershell and bash shell, what am I missing here? Does ls
even work in Github actions?