mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-18 21:18:10 +00:00
Fix: [CI] Allow release-flow to run in forks (while skipping survey-key) (#11241)
This commit is contained in:
parent
abc060525d
commit
110dd0e6c1
15
.github/workflows/release-source.yml
vendored
15
.github/workflows/release-source.yml
vendored
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user