forked from paritytech/metadata-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.77 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- master
env:
NOTIFY_MATRIX: false
NOTIFY_TELEGRAM: true
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
id: checkout
uses: actions/checkout@v3
- uses: ./.github/workflows/rust-install
- name: ⚙ Run verifier
id: verify
run: make verifier
- name: ⚙ Run collector
id: collect
run: |
cargo run --release -- -c=config.toml collect
exit_code=$?
if [ $exit_code -eq 12 ]
then
echo "::set-output name=redeploy::true"
exit 0
fi
echo "::set-output name=redeploy::false"
exit $exit_code
shell: bash {0}
- uses: ./.github/workflows/deploy
id: deploy
if: success() || failure() && (steps.collect.outcome == 'failure')
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Send warning to Matrix channel
uses: s3krit/[email protected]
if: steps.collect.outputs.redeploy == 'true' && env.NOTIFY_MATRIX == 'true'
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
server: ${{ secrets.MATRIX_SERVER }}
message: "⚠️ Warning metadata deployed but should be updated one more time! ⚠️ ${{ env.GITHUB_WORKFLOW_URL }}"
- name: Send warning to Telegram channel
uses: appleboy/telegram-action@master
if: steps.collect.outputs.redeploy == 'true' && env.NOTIFY_TELEGRAM == 'true'
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: "⚠️ Warning metadata deployed but should be updated one more time! ⚠️ ${{ env.GITHUB_WORKFLOW_URL }}️"
- name: Send error to Matrix channel
uses: s3krit/[email protected]
if: failure() && (steps.deploy.outcome == 'failure' || steps.verify.outcome == 'failure') && env.NOTIFY_MATRIX == 'true'
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
server: ${{ secrets.MATRIX_SERVER }}
message: "❌️ Error deploying metadata! ❌ ${{ env.GITHUB_WORKFLOW_URL }}"
- name: Send error to Telegram channel
uses: appleboy/telegram-action@master
if: failure() && (steps.deploy.outcome == 'failure' || steps.verify.outcome == 'failure') && env.NOTIFY_TELEGRAM == 'true'
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: "❌️ Error deploying metadata! ❌ ${{ env.GITHUB_WORKFLOW_URL }}"