Update .forgejo/workflows/CD.yml
This commit is contained in:
parent
31bff11350
commit
f449ee4db0
1 changed files with 22 additions and 3 deletions
|
@ -6,7 +6,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
runs-on: docker
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Determine target host
|
- name: Determine target host
|
||||||
id: determine-host
|
id: determine-host
|
||||||
run: |
|
run: |
|
||||||
folder=$(echo "${{ steps.detect-changes.outputs.folders }}" | head -n 1)
|
folder=${{ steps.detect-changes.outputs.folders }}
|
||||||
case $folder in
|
case $folder in
|
||||||
arrs)
|
arrs)
|
||||||
echo "::set-output name=target_host::${{ secrets.ARRS_IP }}"
|
echo "::set-output name=target_host::${{ secrets.ARRS_IP }}"
|
||||||
|
@ -32,4 +32,23 @@ jobs:
|
||||||
downloaders)
|
downloaders)
|
||||||
echo "::set-output name=target_host::${{ secrets.DOWNLOADERS_IP }}"
|
echo "::set-output name=target_host::${{ secrets.DOWNLOADERS_IP }}"
|
||||||
;;
|
;;
|
||||||
# Add cases for other folders/
|
# Add cases for other folders/hosts
|
||||||
|
*)
|
||||||
|
echo "Unknown folder: $folder"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "::set-output name=folder::$folder"
|
||||||
|
|
||||||
|
- name: Trigger AWX Job
|
||||||
|
run: |
|
||||||
|
curl -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" \
|
||||||
|
-d '{
|
||||||
|
"extra_vars": {
|
||||||
|
"target_host": "${{ steps.determine-host.outputs.target_host }}",
|
||||||
|
"folder": "${{ steps.determine-host.outputs.folder }}"
|
||||||
|
}
|
||||||
|
}' \
|
||||||
|
"https://awx.mafyuh.xyz/api/v2/job_templates/13/github/"
|
||||||
|
|
Reference in a new issue