summary refs log tree commit diff
path: root/.github/actions
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-06-16 10:35:45 +0300
committerWlodekM <[email protected]>2024-06-16 10:35:45 +0300
commitabef6da56913f1c55528103e60a50451a39628b1 (patch)
treeb3c8092471ecbb73e568cd0d336efa0e7871ee8d /.github/actions
initial commit
Diffstat (limited to '.github/actions')
-rw-r--r--.github/actions/notify_failure/action.yml30
-rw-r--r--.github/actions/notify_success/action.yml19
-rw-r--r--.github/actions/upload_build/action.yml19
3 files changed, 68 insertions, 0 deletions
diff --git a/.github/actions/notify_failure/action.yml b/.github/actions/notify_failure/action.yml
new file mode 100644
index 0000000..3ca4019
--- /dev/null
+++ b/.github/actions/notify_failure/action.yml
@@ -0,0 +1,30 @@
+name: Notify failure
+description: Sends a notification that compiling a build has failed
+inputs:
+  BOT_USERNAME:
+    description: 'Username to use for the discord bot message'
+    default: 'CC BuildBot'
+    required: false
+    type: string
+  BOT_AVATAR:
+    description: 'URL to use for the avatar of the discord bot message'
+    default: 'https://static.classicube.net/img/cc-cube-small.png'
+    required: false
+    type: string
+  NOTIFY_MESSAGE:
+    description: 'Notification message to send'
+    required: true
+    type: string
+  WEBHOOK_URL:
+    description: 'Discord webhook URL'
+    required: true
+    type: string
+
+runs:
+  using: "composite"
+  steps:
+    - name: Notify failure
+      shell: sh
+      if: ${{ inputs.WEBHOOK_URL != '' }}
+      run: |
+        curl ${{ inputs.WEBHOOK_URL }} -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"${{ inputs.BOT_USERNAME }}\", \"avatar_url\": \"${{ inputs.BOT_AVATAR }}\", \"content\": \"${{ inputs.NOTIFY_MESSAGE }}\" }"
\ No newline at end of file
diff --git a/.github/actions/notify_success/action.yml b/.github/actions/notify_success/action.yml
new file mode 100644
index 0000000..712ca0d
--- /dev/null
+++ b/.github/actions/notify_success/action.yml
@@ -0,0 +1,19 @@
+name: Notify success
+description: Sends a notification that a workflow has finished
+inputs:
+  DESTINATION_URL:
+    description: 'Webhook notification URL'
+    type: string
+  WORKFLOW_NAME:
+    description: 'Workflow name'
+    required: true
+    type: string
+
+runs:
+  using: "composite"
+  steps:
+    - name: Notify failure
+      if: ${{ inputs.DESTINATION_URL != '' }}
+      shell: sh
+      run: |
+        curl ${{ inputs.DESTINATION_URL }}/${{ inputs.WORKFLOW_NAME }}/${{ github.sha }}
\ No newline at end of file
diff --git a/.github/actions/upload_build/action.yml b/.github/actions/upload_build/action.yml
new file mode 100644
index 0000000..7609946
--- /dev/null
+++ b/.github/actions/upload_build/action.yml
@@ -0,0 +1,19 @@
+name: Upload binary
+description: Uploads a compiled binary
+inputs:
+  SOURCE_FILE:
+    description: 'Path to file to upload'
+    required: true
+    type: string
+  DEST_NAME:
+    description: 'Name to use for the uploaded artifact'
+    required: true
+    type: string
+
+runs:
+  using: "composite"
+  steps:
+    - uses: actions/upload-artifact@v4
+      with:
+        name: ${{ inputs.DEST_NAME }}
+        path: ${{ inputs.SOURCE_FILE }}
\ No newline at end of file