-
Notifications
You must be signed in to change notification settings - Fork 11
/
gitea_actions.yml
45 lines (40 loc) · 2.88 KB
/
gitea_actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This is a simple Gitea Actions job that sends ntfy notifications at the start, and then if the job is a success or a failure.
# It will only run when a tag is created with -example appended. I usually have "version_number-example".
# The notification will look something like this:
# Gitea Actions
# Repo: nickexyz/my_repo
# Branch: refs/tags/0.1-example
# Arch: X64
# Build 0.1-example by niclas
# STARTED
# Buttons: Open run, Open repo
# You will probably need to change:
# runs-on: ci-checker
# As long as the tools you need and curl are available, any container image should work.
# You also need to add some secrets:
# NTFY_URL: The URL to your ntfy instance, including the topic. (https://ntfy.sh/my_topic)
# NTFY_USR: Your ntfy user
# NTFY_PWD: Your ntfy password.
name: Example job with ntfy notifications
on:
push:
tags:
- '*-example'
jobs:
deploy-example:
runs-on: ci-checker
steps:
- name: Job Started
run: |
echo -e "Repo: ${{ gitea.repository }} \nBranch: ${{ gitea.ref }} \nArch: ${{ runner.arch }} \nBuild ${{ gitea.ref_name }} by ${{ gitea.actor }} \nSTARTED" | curl -s -u "${{ secrets.NTFY_USR }}":"${{ secrets.NTFY_PWD }}" -H "tags:timer_clock" -H "X-Icon: https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/favicon.png" -H "Actions: view, Open run, ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/1, clear=true; view, Open repo, ${{ gitea.server_url }}/${{ gitea.repository }}, clear=true;" -H "X-Title: Gitea Actions" -T- "${{ secrets.NTFY_URL }}"
- name: Doing stuff
run: |
echo "Do something here..."
- name: Job Succeeded
if: success()
run: |
echo -e "Repo: ${{ gitea.repository }} \nBranch: ${{ gitea.ref }} \nArch: ${{ runner.arch }} \nBuild ${{ gitea.ref_name }} by ${{ gitea.actor }} \nSUCCEEDED" | curl -s -u "${{ secrets.NTFY_USR }}":"${{ secrets.NTFY_PWD }}" -H "tags:heavy_check_mark" -H "X-Icon: https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/favicon.png" -H "Actions: view, Open run, ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/1, clear=true; view, Open repo, ${{ gitea.server_url }}/${{ gitea.repository }}, clear=true;" -H "X-Title: Gitea Actions" -T- "${{ secrets.NTFY_URL }}"
- name: Job Failed
if: failure()
run: |
echo -e "Repo: ${{ gitea.repository }} \nBranch: ${{ gitea.ref }} \nArch: ${{ runner.arch }} \nBuild ${{ gitea.ref_name }} by ${{ gitea.actor }} \nFAILED" | curl -s -u "${{ secrets.NTFY_USR }}":"${{ secrets.NTFY_PWD }}" -H "tags:x" -H "X-Icon: https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/favicon.png" -H "Actions: view, Open run, ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/1, clear=true; view, Open repo, ${{ gitea.server_url }}/${{ gitea.repository }}, clear=true;" -H "X-Title: Gitea Actions" -T- "${{ secrets.NTFY_URL }}"