-
Notifications
You must be signed in to change notification settings - Fork 10
30 lines (26 loc) · 1.11 KB
/
Copy pathjenkins-trigger-java-dev.yml
File metadata and controls
30 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Trigger Jenkins Job Java 17 (DEV)
on:
push:
branches:
- "dev"
workflow_dispatch:
jobs:
trigger-job:
runs-on: ubuntu-latest
steps:
# Step 1: Get the branch name and build the URL for Jenkins
- name: Get branch name and build Jenkins URL
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/} # Remove 'refs/heads/' from GITHUB_REF
BRANCH_NAME=${BRANCH_NAME#aiccra-} # Remove 'aiccra-' from BRANCH_NAME
JENKINS_URL="https://automation.prms.cgiar.org/job/marlo-dev-docker/build"
echo "Jenkins job URL for the branch $BRANCH_NAME is: $JENKINS_URL"
echo "JENKINS_URL=${JENKINS_URL}" >> $GITHUB_ENV
# Step 2: Execute the curl command to trigger the job in Jenkins with the dynamically built URL
- name: Trigger Jenkins Job
run: |
curl -X POST ${{ env.JENKINS_URL }} --user ${{ secrets.JENKINS_USERNAME }}:${{ secrets.JENKINS_API_TOKEN }}
env:
JENKINS_URL: ${{ env.JENKINS_URL }}
JENKINS_USERNAME: ${{ secrets.JENKINS_USERNAME }}
JENKINS_API_TOKEN: ${{ secrets.JENKINS_API_TOKEN }}