generated from parenthesin/microservice-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (120 loc) · 4.15 KB
/
flyio-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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Deploy
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
run_tests:
strategy:
matrix:
namespace: [ unit, integration ]
operating-system: [ubuntu-latest]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.3.1463
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Execute clojure code
run: clojure -M:test ${{ matrix.namespace }}
build_jar:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Install clojure cli
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.11.3.1463
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Generate uberjar
run: clojure -T:build uberjar
- name: Upload uberjar artifact
uses: actions/upload-artifact@v4
with:
name: built-uberjar
path: target/service.jar
retention-days: 1
update-telegram-commands:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.7.0
with:
babashka-version: 1.3.189
- name: Updates Webhook url
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --update-webhook
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
- name: Updates Slash Commands in Discord
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --update-cmd
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
- name: List Current state of Slash Commands in Discord
run: bb ./scripts/telegram-upsert-webhook-and-commands.bb.clj --list-cmd
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_WEBHOOK: ${{ secrets.TELEGRAM_BOT_WEBHOOK }}
update-discord-slash-commands:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.7.0
with:
babashka-version: 1.3.189
- name: Updates Slash Commands in Discord
run: bb ./scripts/discord-upsert-slash-commands.bb.clj --update
env:
DISCORD_APP_ID: ${{ secrets.DISCORD_APP_ID }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
- name: List Current state of Slash Commands in Discord
run: bb ./scripts/discord-upsert-slash-commands.bb.clj --list
env:
DISCORD_APP_ID: ${{ secrets.DISCORD_APP_ID }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
deploy:
runs-on: ubuntu-latest
needs: [run_tests, build_jar, update-discord-slash-commands, update-telegram-commands]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download uberjar artifact
uses: actions/download-artifact@v4
with:
name: built-uberjar
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}