Update test-hudson-trigger.yml: determine JOB name from github.ref

This commit is contained in:
Axel Uhl
2024-05-08 14:32:21 +02:00
committed by GitHub
parent a892353016
commit 0f4a8bbd57
+9 -1
View File
@@ -8,4 +8,12 @@ jobs:
- name: Trigger hudson job
shell: bash
run: |
curl https://${{ secrets.HUDSON_JOB_USERNAME }}:${{ secrets.HUDSON_JOB_PASSWORD}}@hudson.sapsailing.com/job/TestStatsFromGithubArtifacts/build?token=${{ secrets.HUDSON_JOB_TOKEN }}
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
JOB=SAPSailingAnalytics-master
elif [ "${{ github.ref }}" =~ refs/heads/releases/.* ]; then
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\/releases\///' )
else
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///' )
fi
echo "Identified Hudson job: ${JOB}"
curl https://${{ secrets.HUDSON_JOB_USERNAME }}:${{ secrets.HUDSON_JOB_PASSWORD}}@hudson.sapsailing.com/job/${JOB}/build?token=${{ secrets.HUDSON_JOB_TOKEN }}