Skip to content

Commit

Permalink
CI: Set secrets via environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
univrsal committed May 10, 2024
1 parent 7006ef4 commit 6db46b8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .github/actions/build-plugin/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ runs:
env:
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
LASTFM_KEY: ${{ secrets.LASTFM_KEY }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_TOKEN }}
SPOTIFY_CLIENT_ID: 847d7cf0c5dc4ff185161d1f000a9d0e
run: |
: Run macOS Build
Expand All @@ -55,6 +58,10 @@ runs:
if: runner.os == 'Linux'
shell: zsh --no-rcs --errexit --pipefail {0}
working-directory: ${{ inputs.workingDirectory }}
env:
LASTFM_KEY: ${{ secrets.LASTFM_KEY }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_TOKEN }}
SPOTIFY_CLIENT_ID: 847d7cf0c5dc4ff185161d1f000a9d0e
run: |
: Run Ubuntu Build
Expand All @@ -69,6 +76,10 @@ runs:
- name: Run Windows Build
if: runner.os == 'Windows'
shell: pwsh
env:
LASTFM_KEY: ${{ secrets.LASTFM_KEY }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_TOKEN }}
SPOTIFY_CLIENT_ID: 847d7cf0c5dc4ff185161d1f000a9d0e
run: |
# Run Windows Build
if ( $Env:RUNNER_DEBUG -ne $null ) {
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,23 @@ include_directories(${CPPHTTPLIB_INCLUDE_DIRS})
add_definitions(${LIBCURL_DEFINITIONS})

if (NOT CREDS)
set(CREDS "MISSING")
message(WARNING "Missing Spotify API info")
# Try getting the credentials from the environment
if (DEFINED ENV{SPOTIFY_CLIENT_ID} AND DEFINED ENV{SPOTIFY_CLIENT_SECRET})
set(CREDS "$ENV{SPOTIFY_CLIENT_ID}:$ENV{SPOTIFY_CLIENT_SECRET}")
else()
set(CREDS "MISSING")
message(WARNING "Missing Spotify API info")
endif()
endif()

if (NOT LASTFM_CREDS)
set(LASTFM_CREDS "MISSING")
message(WARNING "Missing Last.fm API info")
# Try getting the credentials from the environment
if (DEFINED ENV{LASTFM_API_KEY} AND DEFINED ENV{LASTFM_API_SECRET})
set(LASTFM_CREDS "$ENV{LASTFM_API_KEY}")
else()
set(LASTFM_CREDS "MISSING")
message(WARNING "Missing LastFM API info")
endif()
endif()

# Get the current working branch
Expand Down

0 comments on commit 6db46b8

Please sign in to comment.