Changeset - r27836:e1c1dfbccca2
[Not reviewed]
master
0 1 0
Patric Stout - 12 months ago 2023-08-28 14:24:07
truebrain@openttd.org
Fix: [CI] Allow release-flow to run in forks (while skipping survey-key) (#11241)
1 file changed with 10 insertions and 5 deletions:
0 comments (0 inline, 0 general)
.github/workflows/release-source.yml
Show inline comments
 
@@ -152,13 +152,18 @@ jobs:
 
    - name: Generate survey key
 
      id: survey_key
 
      run: |
 
        PAYLOAD='{"version":"${{ steps.metadata.outputs.version }}","type":"${{ vars.SURVEY_TYPE }}"}'
 
        if [ -z "${{ vars.SURVEY_TYPE }}" ]; then
 
          echo "SURVEY_TYPE variable not found; most likely running in a fork. Skipping step."
 
          SURVEY_KEY=""
 
        else
 
          PAYLOAD='{"version":"${{ steps.metadata.outputs.version }}","type":"${{ vars.SURVEY_TYPE }}"}'
 

	
 
        echo "${{ secrets.SURVEY_SIGNING_KEY }}" > survey_signing_key.pem
 
        SIGNATURE=$(echo -n "${PAYLOAD}" | openssl dgst -sha256 -sign survey_signing_key.pem | base64 -w0)
 
        rm -f survey_signing_key.pem
 
          echo "${{ secrets.SURVEY_SIGNING_KEY }}" > survey_signing_key.pem
 
          SIGNATURE=$(echo -n "${PAYLOAD}" | openssl dgst -sha256 -sign survey_signing_key.pem | base64 -w0)
 
          rm -f survey_signing_key.pem
 

	
 
        SURVEY_KEY=$(curl -f -s -X POST -d "${PAYLOAD}" -H "Content-Type: application/json" -H "X-Signature: ${SIGNATURE}" https://survey-participate.openttd.org/create-survey-key/${{ vars.SURVEY_TYPE }})
 
          SURVEY_KEY=$(curl -f -s -X POST -d "${PAYLOAD}" -H "Content-Type: application/json" -H "X-Signature: ${SIGNATURE}" https://survey-participate.openttd.org/create-survey-key/${{ vars.SURVEY_TYPE }})
 
        fi
 

	
 
        echo "survey_key=${SURVEY_KEY}" >> $GITHUB_OUTPUT
 

	
0 comments (0 inline, 0 general)