ci: add Nomad auto-deploy workflow on push to main
Some checks are pending
/ deploy (push) Waiting to run
Some checks are pending
/ deploy (push) Waiting to run
This commit is contained in:
parent
a98cc55c7c
commit
ca14ddc8b2
1 changed files with 6 additions and 4 deletions
|
|
@ -10,14 +10,16 @@ jobs:
|
||||||
|
|
||||||
- name: Restart Nomad allocation
|
- name: Restart Nomad allocation
|
||||||
env:
|
env:
|
||||||
NOMAD_ADDR: http://127.0.0.1:4646
|
NOMAD_ADDR: ${{ secrets.NOMAD_ADDR }}
|
||||||
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
|
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
ALLOC_ID=$(curl -sf -H "X-Nomad-Token: $NOMAD_TOKEN" \
|
ALLOC_ID=$(curl -sf \
|
||||||
|
-H "X-Nomad-Token: $NOMAD_TOKEN" \
|
||||||
"$NOMAD_ADDR/v1/jobs/thefatdragon/allocations" \
|
"$NOMAD_ADDR/v1/jobs/thefatdragon/allocations" \
|
||||||
| grep -o '"ID":"[^"]*"' | head -1 | cut -d'"' -f4)
|
| grep -o '"ID":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||||
echo "Restarting allocation: $ALLOC_ID"
|
echo "Restarting allocation: $ALLOC_ID"
|
||||||
curl -sf -X POST -H "X-Nomad-Token: $NOMAD_TOKEN" \
|
curl -sf -X POST \
|
||||||
|
-H "X-Nomad-Token: $NOMAD_TOKEN" \
|
||||||
"$NOMAD_ADDR/v1/client/allocation/$ALLOC_ID/restart"
|
"$NOMAD_ADDR/v1/client/allocation/$ALLOC_ID/restart"
|
||||||
echo "Deploy triggered."
|
echo "Deploy triggered — nginx will re-fetch index.html from git."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue