-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (77 loc) · 2.64 KB
/
deploy.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
name: Deploy to Render
on:
push:
branches:
- main
jobs:
setup:
runs-on: ubuntu-latest
env:
SUPER_SECRET: ${{ secrets.JWT_SECRET }}
MONGODB_URI_TEST: ${{ secrets.MONGODB_URI_TEST }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checkout code
uses: actions/checkout@v2
# Backend
- name: Install backend dependencies
working-directory: ./backend
run: npm install
- name: Run backend tests
working-directory: ./backend
run: npm test
- name: Trigger deploy Backend to Render
uses: JorgeLNJunior/render-deploy@v1.4.4
if: success()
with:
service_id: ${{ secrets.RENDER_BACKEND_SERVICE }}
api_key: ${{ secrets.RENDER_TOKEN }}
# Frontend
- name: Install frontend dependencies
working-directory: ./frontend/webapp
run: npm install
- name: Trigger deploy Frontend to Render
uses: JorgeLNJunior/render-deploy@v1.4.4
if: success()
with:
service_id: ${{ secrets.RENDER_FRONTEND_SERVICE }}
api_key: ${{ secrets.RENDER_TOKEN }}
# Mobile
- name: Setup java
if: success()
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Set up Flutter
if: success()
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Restore gradle.properties
if: success()
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo "::set-env name=GRADLE_USER_HOME::$HOME/.gradle"
echo ${GRADLE_PROPERTIES} > ~/.gradle/gradle.properties
- name: Get flutter app dependencies
if: success()
working-directory: ./frontend/mobile
run: flutter pub get
- name: Start Android release build
if: success()
working-directory: ./frontend/mobile
env:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: flutter build apk --dart-define PUBLIC_ACCESS_TOKEN="$MAPBOX_ACCESS_TOKEN" --dart-define BACKEND_BASE_URL=https://walkaware.onrender.com --dart-define JWT_SECRET="$JWT_SECRET" --dart-define FRONTEND_BASE_URL=https://walkaware-frontend.onrender.com
- name: Archive build result
uses: actions/upload-artifact@v4
with:
name: mobile-app.apk
path: ./frontend/mobile/build/app/outputs/flutter-apk/app-release.apk