This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (96 loc) · 3.59 KB
/
release.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release
on:
pull_request:
branches: [ main ]
jobs:
prepare:
name: Prepare env & label
runs-on: ubuntu-latest
outputs:
get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.REPOS_TOKEN }}
- name: Set label release
uses: actions-ecosystem/action-add-labels@v1
with:
labels: release
- name: Add author as assignees
uses: actions-ecosystem/action-add-assignees@v1
with:
assignees: ${{ github.actor }}
github_token: ${{ secrets.REPOS_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Set tag version to output
id: set_current_tag_id
run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
<b>!!! FAILED !!!</b>
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
docker:
runs-on: ubuntu-latest
needs: prepare
name: Publish on DockerHub
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Containerfile
tags: ${{ secrets.DOCKER_USERNAME }}/quartermaster:latest
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
<b>!!! FAILED !!!</b>
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
telegram:
runs-on: ubuntu-latest
name: Notification
needs: [docker, prepare]
steps:
- name: Notify telegram message after Released
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
${{ github.actor }} created commit:
<b>WorkFlows:</b> <a href="https://github.com/${{ github.repository }}/actions">ActionsList</a>
Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
Repository: ${{ github.repository }}
Branch: ${{ github.ref }}
<b>Pushed image:</b> <code>docker pull ${{ secrets.DOCKER_USERNAME }}/quartermaster:latest</code>
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}