summaryrefslogtreecommitdiff
path: root/.github/actions/meshmc/setup-dependencies/macos/action.yml
blob: 3eb5b37fa6bf5584a4257cdbfe1f94c48bc1de8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Setup macOS dependencies

inputs:
  build-type:
    description: Type for the build
    required: true
    default: Debug
  github-token:
    description: GitHub token for package feed authentication
    required: true

runs:
  using: composite

  steps:
    - name: Install dependencies
      shell: bash
      run: |
        brew update
        brew install ninja extra-cmake-modules temurin@17 mono autoconf libarchive

    - name: Set JAVA_HOME
      shell: bash
      run: |
        echo "JAVA_HOME=$(/usr/libexec/java_home -v 17)" >> "$GITHUB_ENV"

    - name: Setup vcpkg cache
      if: ${{ inputs.build-type == 'Debug' }}
      shell: bash
      env:
        USERNAME: ${{ github.repository_owner }}
        GITHUB_TOKEN: ${{ inputs.github-token }}
        FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
        NUGET_RW: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
      run: |
        mono `vcpkg fetch nuget | tail -n 1` \
          sources add \
          -Source "$FEED_URL" \
          -StorePasswordInClearText \
          -Name GitHubPackages \
          -UserName "$USERNAME" \
          -Password "$GITHUB_TOKEN"
        mono `vcpkg fetch nuget | tail -n 1` \
          setapikey "$GITHUB_TOKEN" \
          -Source "$FEED_URL"
        MODE=$( [ "$NUGET_RW" = "true" ] && echo "readwrite" || echo "read" )
        echo "VCPKG_BINARY_SOURCES=clear;nuget,$FEED_URL,$MODE" >> "$GITHUB_ENV"

    - name: Setup vcpkg environment
      shell: bash
      run: |
        echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"