mirror of
https://github.com/SrIzan10/vinci.git
synced 2026-06-06 01:07:00 +00:00
chore: another approach
This commit is contained in:
35
deploy.sh
35
deploy.sh
@@ -1,26 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# something went wrong function
|
||||
|
||||
something_went_wrong () {
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $COMMITSTATUS" \
|
||||
https://api.github.com/repos/SrIzan10/vinci/statuses/$(git rev-parse origin/main) \
|
||||
-d '{"state":"failure","description":"The build errored!","context":"deployment/rpi"}'
|
||||
}
|
||||
|
||||
# send a pending request thing
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $COMMITSTATUS" \
|
||||
https://api.github.com/repos/SrIzan10/vinci/statuses/$(git rev-parse origin/main) \
|
||||
-d '{"state":"pending","description":"Building...","context":"deployment/rpi"}'
|
||||
|
||||
{
|
||||
doallstuff () {
|
||||
git pull
|
||||
|
||||
docker build . -t srizan10/vinci
|
||||
@@ -30,11 +8,8 @@ https://api.github.com/repos/SrIzan10/vinci/statuses/$(git rev-parse origin/main
|
||||
docker rm vinci
|
||||
|
||||
docker run -d -t --name vinci -p 7272:7272 --restart unless-stopped srizan10/vinci
|
||||
}
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $COMMITSTATUS" \
|
||||
https://api.github.com/repos/SrIzan10/vinci/statuses/$(git rev-parse origin/main) \
|
||||
-d '{"state":"success","description":"The build errored!","context":"deployment/rpi"}'
|
||||
} || something_went_wrong()
|
||||
if doallstuff()
|
||||
then env GITHUB_API=$COMMITSTATUS commit-status success deployment/rpi "Deployment succesful!"
|
||||
else env GITHUB_API=$COMMITSTATUS commit-status failure deployment/rpi "Oops! Something went wrong!"
|
||||
Reference in New Issue
Block a user