diff --git a/.github/workflows/build-sakura.yml b/.github/workflows/build-sakura.yml index f93b306441..6d7c69e703 100644 --- a/.github/workflows/build-sakura.yml +++ b/.github/workflows/build-sakura.yml @@ -54,6 +54,35 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1 + - name: Setup environment variables + run: | + echo "CI_ACCOUNT_NAME=${{github.actor}}" >> $env:GITHUB_ENV + echo "CI_REPO_NAME=${{github.repository}}" >> $env:GITHUB_ENV + echo "CI_BUILD_VERSION=${{github.run_id}}" >> $env:GITHUB_ENV + echo "CI_BUILD_NUMBER=${{github.run_number}}" >> $env:GITHUB_ENV + + echo("CI_BUILD_URL=" ` + + "${env:GITHUB_SERVER_URL}/${{github.repository}}/" ` + + "actions/runs/${{github.run_id}}") >> $env:GITHUB_ENV + + echo("GITHUB_COMMIT_URL=" ` + + "${env:GITHUB_SERVER_URL}/${{github.repository}}/" ` + + "commit/${{github.sha}}") >> $env:GITHUB_ENV + + if ('pull_request' -eq '${{github.event_name}}') { + echo("GITHUB_PR_NUMBER=" ` + + "${{github.event.pull_request.number}}") >> $env:GITHUB_ENV + echo("GITHUB_PR_HEAD_SHORT_COMMIT=" ` + + "${{github.event.pull_request.head.sha}}".SubString(0, 8)) >> $env:GITHUB_ENV + echo("GITHUB_PR_HEAD_COMMIT=" ` + + "${{github.event.pull_request.head.sha}}") >> $env:GITHUB_ENV + echo("GITHUB_PR_HEAD_URL=" ` + + "${env:GITHUB_SERVER_URL}/${{github.repository}}/" ` + + "pull/${{github.event.pull_request.number}}/" ` + + "commits/${{github.event.pull_request.head.sha}}") >> $env:GITHUB_ENV + } + shell: pwsh + - name: MSBuild run: build-sln.bat ${{ matrix.platform }} ${{ matrix.config }} shell: cmd diff --git a/sakura/githash.bat b/sakura/githash.bat index 7c27175313..ca959b6cb7 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -112,17 +112,13 @@ exit /b 0 ) if defined APPVEYOR_PULL_REQUEST_HEAD_COMMIT ( + set GITHUB_PR_HEAD_SHORT_COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT:~0,8% set GITHUB_PR_HEAD_COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT% ) else if defined SYSTEM_PULLREQUEST_SOURCECOMMITID ( + set GITHUB_PR_HEAD_SHORT_COMMIT=%SYSTEM_PULLREQUEST_SOURCECOMMITID:~0,8% set GITHUB_PR_HEAD_COMMIT=%SYSTEM_PULLREQUEST_SOURCECOMMITID% ) - if not "%GITHUB_PR_HEAD_COMMIT%" == "" ( - set GITHUB_PR_HEAD_SHORT_COMMIT=%GITHUB_PR_HEAD_COMMIT:~0,8% - ) else ( - set GITHUB_PR_HEAD_SHORT_COMMIT= - ) - if "%BUILD_REPOSITORY_PROVIDER%"=="GitHub" ( set GITHUB_ON=1 ) @@ -191,24 +187,26 @@ exit /b 0 del "%GITHASH_H_TMP%" @echo %GITHASH_H% was not updated. ) else ( + @echo GIT_TAG_NAME : %GIT_TAG_NAME% @echo GIT_SHORT_COMMIT_HASH : %GIT_SHORT_COMMIT_HASH% @echo GIT_COMMIT_HASH : %GIT_COMMIT_HASH% @echo GIT_REMOTE_ORIGIN_URL : %GIT_REMOTE_ORIGIN_URL% - @echo GIT_TAG_NAME : %GIT_TAG_NAME% @echo. + @echo CI_ACCOUNT_NAME : %CI_ACCOUNT_NAME% @echo CI_REPO_NAME : %CI_REPO_NAME% - @echo CI_ACCOUNT_NAME : %CI_ACCOUNT_NAME% - @echo CI_BUILD_VERSION : %CI_BUILD_VERSION% - @echo CI_BUILD_NUMBER : %CI_BUILD_NUMBER% - @echo CI_BUILD_URL : %CI_BUILD_URL% + @echo CI_BUILD_VERSION : %CI_BUILD_VERSION% + @echo CI_BUILD_NUMBER : %CI_BUILD_NUMBER% + @echo CI_BUILD_URL : %CI_BUILD_URL% @echo. @echo GITHUB_COMMIT_URL : %GITHUB_COMMIT_URL% - @echo GITHUB_PR_HEAD_URL : %GITHUB_PR_HEAD_URL% - @echo GITHUB_PR_HEAD_COMMIT : %GITHUB_PR_HEAD_COMMIT% + @echo GITHUB_PR_NUMBER : %GITHUB_PR_NUMBER% @echo GITHUB_PR_HEAD_SHORT_COMMIT : %GITHUB_PR_HEAD_SHORT_COMMIT% + @echo GITHUB_PR_HEAD_COMMIT : %GITHUB_PR_HEAD_COMMIT% + @echo GITHUB_PR_HEAD_URL : %GITHUB_PR_HEAD_URL% @echo. @echo APPVEYOR_URL : %APPVEYOR_URL% @echo APPVEYOR_PROJECT_SLUG : %APPVEYOR_PROJECT_SLUG% + @echo. if exist "%GITHASH_H%" del "%GITHASH_H%" move /y "%GITHASH_H_TMP%" "%GITHASH_H%"