generated from parenthesin/microservice-boilerplate-malli
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (78 loc) · 2.37 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
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.1.1435
- 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:dev: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.1.1435
- 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
deploy:
runs-on: ubuntu-latest
needs: [run_tests, build_jar]
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
# --ha=false because by default fly.io spins two machines for high availability
- run: flyctl deploy --remote-only --ha=false
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}