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 c301d90
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/build_windows_vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ 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 "${{ 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 "${{ 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 +48,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
15 changes: 11 additions & 4 deletions package/vcpkg/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
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)
else()
# set(GIT_REF "v${VERSION}")
set(GIT_REF "master")
set(GIT_REF "v${VERSION}")
endif()

# Set variables for the port
Expand Down

0 comments on commit c301d90

Please sign in to comment.