Skip to content

Commit 281e243

Browse files
authored
Merge pull request #25 from bakpaul/25_05_add_notify_dash
Add 'Notify dasboard' step to CI
2 parents dd6673c + c3911a5 commit 281e243

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/ci.yml

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

3232
- name: Build and install
33+
id: build-and-install
3334
shell: bash
3435
run: |
3536
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -71,17 +72,42 @@ jobs:
7172
echo "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
7273
7374
- name: Create artifact
75+
id: create-artifact
7476
uses: actions/upload-artifact@v4.4.0
7577
with:
7678
name: ${{ steps.sanitize.outputs.artifact_name }}
7779
path: ${{ env.WORKSPACE_INSTALL_PATH }}
7880

7981
- name: Install artifact
82+
id: install-artifact
8083
uses: actions/download-artifact@v4.1.7
8184
with:
8285
name: ${{ steps.sanitize.outputs.artifact_name }}
8386
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
8487

88+
- name: Notify dashboard
89+
if: always() && startsWith(github.repository, 'sofa-framework') && startsWith(github.ref, 'refs/heads/master') # we are not on a fork and on master
90+
env:
91+
DASH_AUTH: ${{ secrets.PLUGIN_DASH }}
92+
shell: bash
93+
run: |
94+
build_status=$([ '${{ steps.build-and-install.outcome }}' == 'success' ] && \
95+
echo 'true' || echo 'false')
96+
97+
binary_status=$([ '${{ steps.create-artifact.outcome }}' == 'success' ] && \
98+
[ '${{ steps.install-artifact.outcome }}' == 'success' ] && \
99+
[ '${{ steps.sanitize.outcome }}' == 'success' ] && \
100+
echo 'true' || echo 'false')
101+
102+
103+
curl -X POST -H "X-API-KEY: $DASH_AUTH" -H "Content-Type: application/json" -d \
104+
"{\"id\":\"$(echo "${{ github.repository }}" | awk -F/ '{ print $2 }')\",\
105+
\"github_ref\":\"${{ github.sha }}\",\
106+
\"url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\
107+
\"build\":\"$build_status\",\
108+
\"binary\":\"$binary_status\"}"\
109+
https://sofa-framework.org:5000/api/v1/plugins
110+
85111
deploy:
86112
name: Deploy artifacts
87113
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)

0 commit comments

Comments
 (0)