mirror of
https://github.com/luc-github/ESP3D-WEBUI.git
synced 2025-10-31 11:56:46 -07:00
Add discord notification
Update CI badge
This commit is contained in:
37
.github/ci/final-check.sh
vendored
Normal file
37
.github/ci/final-check.sh
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
# Enable the globstar shell option
|
||||
shopt -s globstar
|
||||
# Make sure we are inside the github workspace
|
||||
cd $GITHUB_WORKSPACE
|
||||
echo $STEPS_CONTEXT
|
||||
step=$1
|
||||
status=$2
|
||||
export BODYMESSAGE="$(git log -1 $GITHUB_SHA --pretty=oneline --abbrev-commit)"
|
||||
export BACKTICK='`';
|
||||
export TIMESTAMP=$(date --utc +%FT%TZ);
|
||||
export GITHUB_ACTOR_NAME="$(git log -1 $GITHUB_SHA --pretty="%aN")";
|
||||
export COMMIT_FORMATTED="[$BACKTICK${GITHUB_SHA:0:7}$BACKTICK](https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)";
|
||||
|
||||
if [[ "$status" == "success" ]];
|
||||
then
|
||||
echo "Success build"
|
||||
if [ -z "$DISCORD_WEBHOOK_URL" ];
|
||||
then
|
||||
echo "no need bot"
|
||||
else
|
||||
curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"avatar_url":"https://pngimg.com/uploads/github/github_PNG90.png","username":"github-action","embeds":[{"author":{"name":"Build #'"$step"' Passed - '"$GITHUB_ACTOR_NAME"'","url":"https://github.com/'"$GITHUB_REPOSITORY"'/actions/runs/'"$GITHUB_RUN_ID"'"},"url":"https://github.com/'"$GITHUB_REPOSITORY"'/actions/runs/'"$GITHUB_RUN_ID"'","title":"['"$GITHUB_REPOSITORY"':job#'"$GITHUB_RUN_NUMBER"'] ","color":65280,"fields":[{"name":"_ _", "value": "'"$COMMIT_FORMATTED"' - '"$BODYMESSAGE"'"}],"timestamp":"'"$TIMESTAMP"'","footer":{"text":"ESP3D CI"}}]}' $DISCORD_WEBHOOK_URL;
|
||||
fi
|
||||
else
|
||||
echo "Build failed"
|
||||
if [ -z "$DISCORD_WEBHOOK_URL" ];
|
||||
then
|
||||
echo "no need bot"
|
||||
else
|
||||
curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"avatar_url":"https://pngimg.com/uploads/github/github_PNG90.png","username":"github-action","embeds":[{"author":{"name":"Build #'"$step"' Failed - '"$GITHUB_ACTOR_NAME"'","url":"https://github.com/'"$GITHUB_REPOSITORY"'/actions/runs/'"$GITHUB_RUN_ID"'"},"url":"https://github.com/'"$GITHUB_REPOSITORY"'/actions/runs/'"$GITHUB_RUN_ID"'","title":"['"$GITHUB_REPOSITORY"':job#'"$GITHUB_RUN_NUMBER"'] ","color":16711680,"fields":[{"name":"_ _", "value": "'"$COMMIT_FORMATTED"' - '"$BODYMESSAGE"'"}],"timestamp":"'"$TIMESTAMP"'","footer":{"text":"ESP3D CI"}}]}' $DISCORD_WEBHOOK_URL;
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
17
.github/workflows/build-ci.yml
vendored
17
.github/workflows/build-ci.yml
vendored
@@ -12,10 +12,21 @@ jobs:
|
||||
with:
|
||||
node-version: '16.x'
|
||||
- name: Install libraries
|
||||
id: setuptools
|
||||
run: npm install
|
||||
continue-on-error: true
|
||||
- name: Build all files
|
||||
id: buildall
|
||||
run: npm run buildall
|
||||
continue-on-error: true
|
||||
- name: Check Failures
|
||||
if: ${{ failure() }}
|
||||
run: echo "Build failed"
|
||||
- name: Failure check
|
||||
env:
|
||||
STEPS_CONTEXT: ${{ toJson(steps) }}
|
||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
if: steps.setuptools.outcome == 'failure' || steps.buildall.outcome == 'failure'
|
||||
run: bash ./.github/ci/final-check.sh "$GITHUB_RUN_ID" "failure"
|
||||
- name: Success check
|
||||
env:
|
||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
if: steps.setuptools.outcome == 'success' && steps.buildall.outcome == 'success'
|
||||
run: bash ./.github/ci/final-check.sh "$GITHUB_RUN_ID" "success"
|
||||
|
||||
@@ -7,7 +7,7 @@ Rewrite per @alxblog suggestion to use proper Preactjs API and lighter code: use
|
||||
|
||||
Only compatible with [ESP3DLib 3.0](https://github.com/luc-github/ESP3DLib/tree/3.0) , [ESP3D 3.0](https://github.com/luc-github/ESP3D/tree/3.0), [grblHAL](https://github.com/grblHAL)
|
||||
|
||||
[Latest development version ](https://github.com/luc-github/ESP3D-WEBUI/tree/3.0)  [](https://travis-ci.org/github/luc-github/ESP3D-WEBUI) [](https://github.com/users/luc-github/projects/1/views/1)
|
||||
[Latest development version ](https://github.com/luc-github/ESP3D-WEBUI/tree/3.0)  [](https://github.com/luc-github/ESP3D-WEBUI/actions/workflows/build-ci.yml) [](https://github.com/users/luc-github/projects/1/views/1)
|
||||
|
||||
### Setup development tools
|
||||
|
||||
|
||||
Reference in New Issue
Block a user