Skip to content

Conditionalize NuGet steps to run only if GH_PACKAGES_TOKEN secret is… #17

Conditionalize NuGet steps to run only if GH_PACKAGES_TOKEN secret is…

Conditionalize NuGet steps to run only if GH_PACKAGES_TOKEN secret is… #17

Workflow file for this run

name: CMake
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
include:
- os: macos-latest
nuget: mono `./vcpkg/vcpkg fetch nuget | tail -n 1`
- os: ubuntu-latest
nuget: mono `./vcpkg/vcpkg fetch nuget | tail -n 1`
- os: windows-latest
nuget: nuget
runs-on: ${{matrix.os}}
env:
FEED_URL: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Install Prerequisites Linux
if: ${{matrix.os == 'ubuntu-latest' && secrets.GH_PACKAGES_TOKEN != ''}}

Check failure on line 33 in .github/workflows/cmake.yml

View workflow run for this annotation

GitHub Actions / CMake

Invalid workflow file

The workflow is not valid. .github/workflows/cmake.yml (Line: 33, Col: 11): Unrecognized named-value: 'secrets'. Located at position 33 within expression: matrix.os == 'ubuntu-latest' && secrets.GH_PACKAGES_TOKEN != '' .github/workflows/cmake.yml (Line: 40, Col: 11): Unrecognized named-value: 'secrets'. Located at position 32 within expression: matrix.os == 'macos-latest' && secrets.GH_PACKAGES_TOKEN != ''
shell: bash
run: |
${{github.workspace}}/vcpkg/bootstrap-vcpkg.sh
sudo apt install mono-complete
- name: Install Prerequisites macOS
if: ${{matrix.os == 'macos-latest' && secrets.GH_PACKAGES_TOKEN != ''}}
shell: bash
run: |
${{github.workspace}}/vcpkg/bootstrap-vcpkg.sh
- name: Add NuGet sources
if: ${{secrets.GH_PACKAGES_TOKEN != ''}}
shell: bash
run: |
${{matrix.nuget}} \
sources add \
-Source "${{env.FEED_URL}}" \
-StorePasswordInClearText \
-Name GitHubPackages \
-UserName "${{github.repository_owner}}" \
-Password "${{secrets.GH_PACKAGES_TOKEN}}"
${{matrix.nuget}} \
setapikey "${{secrets.GH_PACKAGES_TOKEN}}" \
-Source "${{env.FEED_URL}}"
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2
with:
cmake-version: '3.31'
- name: Run Workflow
env:
VCPKG_BINARY_SOURCES: "clear;nuget,${{env.FEED_URL}},readwrite"
run: |
cmake --version
cmake --workflow --preset default