Skip to content

Commit

Permalink
Add support for PR's
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaquewithaq committed Feb 3, 2024
1 parent ee92368 commit 01f402e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/build_windows_vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,27 @@ jobs:
name: Shared Library
runs-on: windows-latest

env:
EVENT_CONTEXT: ${{ toJson(github.event) }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set GIT_REF (PR)
run: |
echo $EVENT_CONTEXT
echo "${{ github.event.pull_request.head.repo.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO
echo "${{ github.event.pull_request.head.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
if: github.event_name == 'pull_request'

- name: Set GIT_REF
run: echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
- name: Set GIT_REF (Non-PR)
run: |
echo $EVENT_CONTEXT
echo "${{ github.event.repository.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO
echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
if: github.event_name != 'pull_request'

- name: Install
run: |
Expand All @@ -34,8 +50,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set GIT_REF
run: echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
- name: Set GIT_REF (PR)
run: |
echo "${{ github.event.pull_request.head.repo.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO
echo "${{ github.event.pull_request.head.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
if: github.event_name == 'pull_request'

- name: Set GIT_REF (Non-PR)
run: |
echo "${{ github.event.repository.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO
echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF
if: github.event_name != 'pull_request'

- name: Install
run: |
Expand Down
20 changes: 18 additions & 2 deletions package/vcpkg/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
find_program(GIT git)

# GitHub repository
set(GIT_URL "https://github.com/projectM-visualizer/projectm.git")
# Set GIT_REPO to the contents of GIT_REPO file or to default
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/GIT_REPO)
file(READ ${CMAKE_CURRENT_LIST_DIR}/GIT_REPO GIT_REPO)
string(STRIP ${GIT_REPO} GIT_REPO)

set(GIT_URL "https://github.com/${GIT_REPO}.git")
else()
set(GIT_URL "https://github.com/projectM-visualizer/projectm.git")
endif()

# Set GIT_REF to the contents of GIT_REF file, or to VERSION
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/GIT_REF)
file(READ ${CMAKE_CURRENT_LIST_DIR}/GIT_REF GIT_REF)
string(STRIP ${GIT_REF} GIT_REF)
Expand All @@ -26,6 +34,14 @@ else()
set(GIT_CLONE_COMMAND ${GIT} clone --depth 1 --branch master --recurse-submodules ${GIT_URL} ${SOURCE_PATH})
endif()

# DEBUGGING
message(STATUS "GIT_REPO: ${GIT_REPO}")
message(STATUS "GIT_URL: ${GIT_URL}")
message(STATUS "GIT_REF: ${GIT_REF}")
message(STATUS "PORT_NAME: ${PORT_NAME}")
message(STATUS "SOURCE_PATH: ${SOURCE_PATH}")
message(STATUS "GIT_CLONE_COMMAND: ${GIT_CLONE_COMMAND}")

# Pull source from GitHub with submodules
if(EXISTS "${SOURCE_PATH}" AND NOT EXISTS "${SOURCE_PATH}/.git")

Expand Down

0 comments on commit 01f402e

Please sign in to comment.