-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (105 loc) · 3.76 KB
/
CD.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
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
name: Deploy
on:
pull_request:
types:
- closed
branches:
- "dev"
- "main"
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: self-hosted
environment: ${{ github.base_ref }}
steps:
- uses: actions/checkout@v3
- name: Download the table
if: github.base_ref == 'main'
run: curl -L "docs.google.com/spreadsheets/d/${{ secrets.SHEET_ID }}/gviz/tq?tqx=out:csv&sheet=Ukrainian" -o table.csv
- uses: actions/upload-artifact@v3
if: inputs.upload-artifact
with:
name: table
path: table.csv
- uses: dawidd6/action-download-artifact@v6
with:
pr: ${{github.event.pull_request.number}}
workflow: CI.yml
name: executable
skip_unpack: true
# path: bin/bot
- run: unzip executable.zip -d bin
- name: Restart bot
env:
TELOXIDE_TOKEN: ${{ secrets.TELOXIDE_TOKEN }}
run: |
docker build -t first_aid_bot:${{ github.base_ref == 'main' && 'main' || 'dev' }} .
docker compose -f docker-compose_${{ github.base_ref == 'main' && 'main' || 'dev' }}.yml -p ${{ github.base_ref == 'main' && 'main' || 'dev' }}_bot up -d
release:
runs-on: ubuntu-latest
if: github.base_ref == 'main' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: table
- uses: dawidd6/action-download-artifact@v6
with:
pr: ${{github.event.pull_request.number}}
workflow: CI.yml
name: executable
- uses: dawidd6/action-download-artifact@v6
with:
pr: ${{github.event.pull_request.number}}
workflow: CI.yml
name: apk
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
app-release.apk
table.csv
first_aid_bot
# notify:
# runs-on: ubuntu-latest
# needs: deploy
# if: github.base_ref == 'main'
#
# steps:
# - uses: dawidd6/action-download-artifact@v6
# with:
# pr: ${{github.event.pull_request.number}}
# workflow: CI.yml
# name: apk
#
# - name: send telegram message on push
# uses: appleboy/telegram-action@master
# if: always() && github.base_ref == 'main' && !contains(needs.*.result, 'failure')
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# document: app-release.apk
# message: |
# ${{ github.actor }} created commit:
# Commit message: ${{ github.event.commits[0].message }}
#
# See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}}
# See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# Successfully deployed! 🙆
#
# - name: send telegram message on push
# uses: appleboy/telegram-action@master
# if: always() && github.base_ref == 'main' && contains(needs.*.result, 'failure')
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# document: table.csv
# message: |
# ${{ github.actor }} created commit:
# Commit message: ${{ github.event.commits[0].message }}
#
# See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}}
# See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# The commit fails to build or tests have failed! 💣