-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
64 lines (56 loc) · 1.75 KB
/
.gitlab-ci.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
before_script:
- echo "const versionName = '$CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA';" > lib/generated/application_information/about_contents.dart
- if [[ $Attributions ]]; then echo "const applicationLegalese = '$Attributions';" >> lib/generated/application_information/about_contents.dart; fi
- cat lib/generated/application_information/about_contents.dart
test:
stage: test
image: "ghcr.io/cirruslabs/flutter:stable"
script:
- flutter test test/unit_tests
web:
stage: build
image: "ghcr.io/cirruslabs/flutter:stable"
needs:
- test
script:
- flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=/canvaskit/ # Self host canvaskit
- tar -cvf web.tar -C ./build/ web
artifacts:
name: web
paths:
- $CI_PROJECT_DIR/web.tar
apk:
stage: build
image: "ghcr.io/cirruslabs/flutter:stable"
needs:
- test
script:
- flutter build apk
after_script:
- mv $CI_PROJECT_DIR/build/app/outputs/apk/release/app-release.apk $CI_PROJECT_DIR/lernapp.apk
artifacts:
name: android
paths:
- $CI_PROJECT_DIR/lernapp.apk
deploy:
stage: deploy
needs:
- web
only:
- master
image: "ghcr.io/cirruslabs/flutter:stable"
script:
# Ssh refuses to read keyfiles which are globally readable
- chmod 600 $DeployKey
- mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
# Ssh won't connect to unknown keys in non-interactive mode, this figures out the server's keys
- ssh-keyscan $DeployTargetServer >> ~/.ssh/known_hosts
- tar -xvf $CI_PROJECT_DIR/web.tar
- ssh -i $DeployKey $DeployUser@$DeployTargetServer "rm -r /var/www/html/lernapp"
- scp -i $DeployKey -r web $DeployUser@$DeployTargetServer:/var/www/html/lernapp
after_script:
- rm -r web
stages:
- test
- build
- deploy