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 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
.github/workflows/release-source.yml
Show inline comments
 
@@ -131,55 +131,60 @@ jobs:
 
        cp .release_date build/bundles/released.txt
 
        cp README.md build/bundles/README.md
 
        echo "::endgroup::"
 

	
 
        echo "Release Date: $(cat .release_date)"
 
        echo "Revision: $(cat .ottdrev)"
 
        echo "Version: $(cat .version)"
 
        echo "Is tag: ${IS_TAG}"
 
        echo "Folder on CDN: ${FOLDER}"
 
        echo "Workflow trigger: ${TRIGGER_TYPE}"
 

	
 
        echo "version=$(cat .version)" >> $GITHUB_OUTPUT
 
        echo "is_tag=${IS_TAG}" >> $GITHUB_OUTPUT
 
        echo "folder=${FOLDER}" >> $GITHUB_OUTPUT
 
        echo "trigger_type=${TRIGGER_TYPE}" >> $GITHUB_OUTPUT
 
      env:
 
        NIGHTLIES_BRANCH: master
 
        FOLDER_RELEASES: openttd-releases
 
        FOLDER_NIGHTLIES: openttd-nightlies
 
        FOLDER_BRANCHES: openttd-branches
 

	
 
    - name: Generate survey key
 
      id: survey_key
 
      run: |
 
        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
 

	
 
        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
 

	
 
    - name: Remove VCS information
 
      run: |
 
        rm -rf .git
 

	
 
    - name: Create bundles
 
      run: |
 
        FOLDER_NAME=openttd-${{ steps.metadata.outputs.version }}
 

	
 
        # Rename the folder to openttd-NNN
 
        mkdir ${FOLDER_NAME}
 
        find . -maxdepth 1 -not -name . -not -name build -not -name ${FOLDER_NAME} -exec mv {} ${FOLDER_NAME}/ \;
 

	
 
        echo "::group::Create tarball (xz) bundle"
 
        tar --xz -cvf build/bundles/${FOLDER_NAME}-source.tar.xz ${FOLDER_NAME}
 
        echo "::endgroup::"
 

	
 
        # This tarball is only to be used within this workflow.
 
        echo "::group::Create tarball (gz) bundle"
 
        tar --gzip -cvf source.tar.gz ${FOLDER_NAME}
 
        echo "::endgroup::"
 

	
0 comments (0 inline, 0 general)