forked from pbek/QOwnNotes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
51 lines (47 loc) · 1.64 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
#
# GitLab CI configuration for QOwnNotes
# https://ci.gitlab.com/lint
#
# you need a runner for OS X
# https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
#
# execute: gitlab-ci-multi-runner run
#
# set the GITHUB_ACCESS_TOKEN with your GitHub securitry token for release deployment
#
before_script:
- PATH="/Applications/Qt/5.4/clang_64/bin:$PATH"
- QTDIR="/Applications/Qt/5.4/clang_64"
- cd src
# http://doc.gitlab.com/ci/variables/README.html
- echo "#define BUILD ""$CI_BUILD_ID" > build_number.h
- qmake -project
- qmake QOwnNotes.pro -r -spec macx-clang CONFIG+=x86_64
- make
build_job:
type: build
script:
- echo do some testing...
only:
- develop
- master
deployment_job:
type: deploy
script:
- ../gitlab-ci/create-dmg.sh
- RELEASE_JSON_FILE="../gitlab-ci/github-release.json"
- cat $RELEASE_JSON_FILE
- sed -i -e 's/CI_BUILD_ID/'"$CI_BUILD_ID"'/g' $RELEASE_JSON_FILE
- API_JSON=$(cat $RELEASE_JSON_FILE)
# creating the GitHub release and parsing returned release id
# $GITHUB_ACCESS_TOKEN is set as a secret variable
# https://ci.gitlab.com/projects/5070/variables
# https://github.com/settings/tokens
- RELEASE_ID=$(curl --data "$API_JSON" https://api.github.com/repos/pbek/QOwnNotes/releases?access_token=$GITHUB_ACCESS_TOKEN | python -c 'import sys, json; print json.load(sys.stdin)["id"]')
- echo $RELEASE_ID
# check if $RELEASE_ID is greater than 0, fail build if not
- if [[ ! $RELEASE_ID -gt 0 ]]; then exit 1; fi
# deploy QOwnNotes.dmg to GitHub Releases
- ../gitlab-ci/deploy-file.sh $RELEASE_ID $GITHUB_ACCESS_TOKEN
only:
- master