Skip to content

Commit 077c958

Browse files
authored
Add 'Notify dasboard' step to CI (#161)
1 parent 46497e1 commit 077c958

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
path: ${{ env.WORKSPACE_SRC_PATH }}
3232

3333
- name: Build and install
34+
id: build-and-install
3435
shell: bash
3536
run: |
3637
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -72,12 +73,14 @@ jobs:
7273
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
7374
7475
- name: Create artifact
76+
id: create-artifact
7577
uses: actions/[email protected]
7678
with:
7779
name: ${{ steps.sanitize.outputs.artifact_name }}
7880
path: ${{ env.WORKSPACE_INSTALL_PATH }}
7981

8082
- name: Install artifact
83+
id: install-artifact
8184
uses: actions/[email protected]
8285
with:
8386
name: ${{ steps.sanitize.outputs.artifact_name }}
@@ -99,6 +102,29 @@ jobs:
99102
echo '----------------------'
100103
python -c "import sys; print('sys.version = ' + str(sys.version)); print('sys.path = ' + str(sys.path))"
101104
105+
- name: Notify dashboard
106+
if: always() && startsWith(github.repository, 'SofaDefrost') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
107+
env:
108+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
109+
shell: bash
110+
run: |
111+
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \
112+
echo 'true' || echo 'false')
113+
114+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
115+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
116+
[ '${{ steps.sanitize.outcome }}' == 'success' ] && \
117+
echo 'true' || echo 'false')
118+
119+
120+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
121+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
122+
\"github_ref\":\"${{ github.sha }}\",\
123+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
124+
\"build\":$build_status,\
125+
\"binary\":$binary_status}"\
126+
https://sofa-framework.org:5000/api/v1/plugins
127+
102128
deploy:
103129
name: Deploy artifacts
104130
if: always() && startsWith(github.repository, 'SofaDefrost') && (startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/')) # we are not on a fork and on a branch or a tag (not a PR)

0 commit comments

Comments
 (0)