|
| 1 | +name: 'Setup vcpkg' |
| 2 | +description: 'Installs vcpkg and initialises binary caching via NuGet' |
| 3 | +inputs: |
| 4 | + vcpkg-location: |
| 5 | + description: 'Where to install vcpkg' |
| 6 | + required: true |
| 7 | + default: '${{ runner.temp }}/vcpkg' |
| 8 | + mono-install-command: |
| 9 | + description: 'Command to run to install mono' |
| 10 | + required: false |
| 11 | + default: ${{ runner.os == 'macOS' && 'brew install mono' || runner.os == 'Linux' && 'sudo apt-get install -y --no-install-recommends mono-complete' || '' }} |
| 12 | +outputs: |
| 13 | + vcpkg-location: |
| 14 | + description: 'Where vcpkg is installed' |
| 15 | + value: ${{ inputs.vcpkg-location }} |
| 16 | + vcpkg: |
| 17 | + description: 'The vcpkg executable' |
| 18 | + value: '${{ inputs.vcpkg-location }}/vcpkg' |
| 19 | + vcpkg-cmake: |
| 20 | + description: 'The vcpkg cmake toolchain' |
| 21 | + value: '${{ inputs.vcpkg-location }}/scripts/buildsystems/vcpkg.cmake' |
| 22 | + |
| 23 | +runs: |
| 24 | + using: "composite" |
| 25 | + steps: |
| 26 | + - name: Install vcpkg |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + git clone https://github.com/microsoft/vcpkg "${{ inputs.vcpkg-location }}" |
| 30 | + cd "${{ inputs.vcpkg-location }}" |
| 31 | + ./bootstrap-vcpkg.$(if [ "${{ runner.os }}" = "Windows" ]; then echo "bat"; else echo "sh"; fi) -disableMetrics |
| 32 | +
|
| 33 | + - name: Install mono |
| 34 | + if: inputs.mono-install-command |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + ${{ inputs.mono-install-command }} |
| 38 | +
|
| 39 | + - name: Setup NuGet Credentials |
| 40 | + shell: bash |
| 41 | + env: |
| 42 | + FEED_URL: 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json' |
| 43 | + run: | |
| 44 | + cd "${{ inputs.vcpkg-location }}" |
| 45 | + ${{ inputs.mono-install-command && 'mono' }} $(./vcpkg fetch nuget | tail -n 1) \ |
| 46 | + sources add \ |
| 47 | + -source "${{ env.FEED_URL }}" \ |
| 48 | + -storepasswordincleartext \ |
| 49 | + -name "GitHub" \ |
| 50 | + -username "${{ github.repository_owner }}" \ |
| 51 | + -password "${{ github.token }}" |
| 52 | + ${{ inputs.mono-install-command && 'mono' }} $(./vcpkg fetch nuget | tail -n 1) \ |
| 53 | + setapikey "${{ github.token }}" \ |
| 54 | + -source "${{ env.FEED_URL }}" |
| 55 | +
|
| 56 | + - name: Setup vcpkg caching |
| 57 | + uses: actions/github-script@v8 |
| 58 | + with: |
| 59 | + script: | |
| 60 | + core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;nuget,GitHub,readwrite') |
| 61 | +
|
0 commit comments