1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 02:19:09 +00:00

Fix: [CI] Allow release-flow to run in forks (while skipping survey-key) (#11241)

This commit is contained in:
Patric Stout
2023-08-28 16:24:07 +02:00
committed by GitHub
parent abc060525d
commit 110dd0e6c1

View File

@@ -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