-
-
Notifications
You must be signed in to change notification settings - Fork 128
executable file
·42 lines (39 loc) · 2.44 KB
/
package_trigger.yml
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
31
32
33
34
35
36
37
38
39
40
41
42
name: Package Trigger Main
on:
workflow_dispatch:
jobs:
package-trigger-develop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Package Trigger
if: github.ref == 'refs/heads/develop'
run: |
if [ -n "${{ secrets.PAUSE_PACKAGE_TRIGGER_NEXTCLOUD_DEVELOP }}" ]; then
echo "**** Github secret PAUSE_PACKAGE_TRIGGER_NEXTCLOUD_DEVELOP is set; skipping trigger. ****"
echo "Github secret \`PAUSE_PACKAGE_TRIGGER_NEXTCLOUD_DEVELOP\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
exit 0
fi
if [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-nextcloud/job/develop/lastBuild/api/json | jq -r '.building') == "true" ]; then
echo "**** There already seems to be an active build on Jenkins; skipping package trigger ****"
echo "There already seems to be an active build on Jenkins; skipping package trigger" >> $GITHUB_STEP_SUMMARY
exit 0
fi
echo "**** Package trigger running off of develop branch. To disable, set a Github secret named \"PAUSE_PACKAGE_TRIGGER_NEXTCLOUD_DEVELOP\". ****"
echo "Package trigger running off of develop branch. To disable, set a Github secret named \`PAUSE_PACKAGE_TRIGGER_NEXTCLOUD_DEVELOP\`" >> $GITHUB_STEP_SUMMARY
response=$(curl -iX POST \
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-nextcloud/job/develop/buildWithParameters?PACKAGE_CHECK=true \
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
echo "**** Jenkins job queue url: ${response%$'\r'} ****"
echo "**** Sleeping 10 seconds until job starts ****"
sleep 10
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
buildurl="${buildurl%$'\r'}"
echo "**** Jenkins job build url: ${buildurl} ****"
echo "Jenkins job build url: ${buildurl}" >> $GITHUB_STEP_SUMMARY
echo "**** Attempting to change the Jenkins job description ****"
curl -iX POST \
"${buildurl}submitDescription" \
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
--data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--data-urlencode "Submit=Submit"