1- version : 2
1+ version : 2.1
22
33jobs :
44
5- # build-macos:
6- # macos:
7- # xcode: "9.0"
8- # environment:
9- # FL_OUTPUT_DIR: output
10- # steps:
11- # - checkout
12- # - run:
13- # name: Setup Certificates
14- # command: |
15- # security create-keychain -p $keychain default.keychain
16- # echo $certificate | base64 -D > /tmp/default.p12
17- # security import /tmp/default.p12 -t agg -k default.keychain -P '' -A
18- # - run:
19- # name: Setup NVM
20- # command: |
21- # export NODE_VERSION=$(cat .nvmrc)
22- # curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash -s -- --no-use
23- # echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
24- # echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
25- # echo 'nvm install v11.12.0' >> $BASH_ENV
26- # echo 'nvm alias default v11.12.0' >> $BASH_ENV
27- # - run:
28- # command: yarn --frozen-lockfile
29- # - run:
30- # command: CSC_LINK=file:///tmp/default.p12 yarn run package:mac
31- # - run:
32- # command: mv dist dist-mac
33- # - persist_to_workspace:
34- # root: .
35- # paths:
36- # - dist-mac
37-
38- # build-linux:
39- # docker:
40- # - image: circleci/node:11.12.0
41- # environment:
42- # BASH_ENV: ".circleci/bashrc"
43- # steps:
44- # - checkout
45- # - run:
46- # command: yarn --frozen-lockfile
47- # - run:
48- # command: yarn run package:linux
49- # - run:
50- # command: mv dist dist-linux
51- # - persist_to_workspace:
52- # root: .
53- # paths:
54- # - dist-linux
55-
56- deploy :
5+ build-macos :
6+ macos :
7+ xcode : " 9.0"
8+ environment :
9+ FL_OUTPUT_DIR : output
10+ steps :
11+ - checkout
12+ - run :
13+ name : Setup Certificates
14+ command : |
15+ security create-keychain -p $keychain default.keychain
16+ echo $certificate | base64 -D > /tmp/default.p12
17+ security import /tmp/default.p12 -t agg -k default.keychain -P '' -A
18+ - run :
19+ name : Setup NVM
20+ command : |
21+ export NODE_VERSION=$(cat .nvmrc)
22+ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash -s -- --no-use
23+ echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
24+ echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
25+ echo 'nvm install v11.12.0' >> $BASH_ENV
26+ echo 'nvm alias default v11.12.0' >> $BASH_ENV
27+ - run :
28+ command : yarn && yarn run link
29+ - run :
30+ command : |
31+ export NODE_ENV=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "production" || echo "development")
32+ CSC_LINK=file:///tmp/default.p12 yarn run package:mac
33+ - run :
34+ command : mv dist dist-macos
35+ - persist_to_workspace :
36+ root : .
37+ paths :
38+ - dist-macos
39+
40+ build-linux :
5741 docker :
5842 - image : circleci/node:11.12.0
5943 environment :
6044 BASH_ENV : " .circleci/bashrc"
6145 steps :
6246 - checkout
63- # - attach_workspace:
64- # at: /tmp/workspace
6547 - run :
66- command : yarn --frozen-lockfile
48+ command : yarn && yarn run link
6749 - run :
6850 command : |
69- TARGET=electron yarn run build
70- mv ./app/dist /tmp/build-electron
71- # - run:
72- # command: |
73- # TARGET=web yarn run build
74- # mv ./app/dist /tmp/build-web
51+ export NODE_ENV=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "production" || echo "development")
52+ yarn run package:linux
53+ - run :
54+ command : mv dist dist-linux
55+ - persist_to_workspace :
56+ root : .
57+ paths :
58+ - dist-linux
7559
60+ build-web :
61+ docker :
62+ - image : circleci/node:11.12.0
63+ environment :
64+ BASH_ENV : " .circleci/bashrc"
65+ steps :
66+ - checkout
67+ - run :
68+ command : yarn && yarn run link
69+ - run :
70+ command : |
71+ export NODE_ENV=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "production" || echo "development")
72+ TARGET=electron yarn run build:renderer
73+ mv ./app/dist dist-web-electron
74+ - run :
75+ command : |
76+ export NODE_ENV=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "production" || echo "development")
77+ TARGET=browser yarn run build:renderer
78+ mv ./app/dist dist-web-browser
79+ - persist_to_workspace :
80+ root : .
81+ paths :
82+ - dist-web-electron
83+ - dist-web-browser
84+
85+ deploy-releases :
86+ docker :
87+ - image : circleci/node:11.12.0
88+ environment :
89+ BASH_ENV : " .circleci/bashrc"
90+ steps :
91+ - checkout
92+ - attach_workspace :
93+ at : /tmp/workspace
94+ - run :
95+ name : Install deployment dependencies
96+ command : |
97+ wget https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 -O /home/circleci/linux-amd64-github-release.tar.bz2
98+ tar xjf /home/circleci/linux-amd64-github-release.tar.bz2 -C /home/circleci
99+ sudo mv /home/circleci/bin/linux/amd64/github-release /usr/local/bin
100+ rm -Rf /home/circleci/bin/linux
101+ chmod a+x /usr/local/bin/github-release
102+ - run :
103+ name : Deploy releases
104+ command : |
105+ VERSION=v`jq -r '.version' package.json`
106+ VERSION_TAG=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "${VERSION}" || echo "${VERSION}-rc")
107+ TAG=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "latest" || echo "nightly")
108+
109+ RELEASE_OPTS=""
110+ if [ "${CIRCLE_BRANCH}" != "master" ]; then
111+
112+ if git tag -l | grep -q "^${VERSION}$"
113+ then
114+ echo "Warning: Found production tag. Please update the version on package.json."
115+ exit 1
116+ fi
117+
118+ git tag --delete "${VERSION_TAG}" || true
119+ git push --delete origin "${VERSION_TAG}" || true
120+ github-release delete -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" || true
121+ RELEASE_OPTS="--pre-release"
122+ fi
123+
124+ git tag --delete "${TAG}" || true
125+ git push --delete origin "${TAG}" || true
126+ github-release delete -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" || true
127+
128+ cd /tmp/workspace/dist-web-browser
129+ zip -r /tmp/c-pac_gui-${VERSION_TAG}-browser.zip .
130+ cd -
131+
132+ git tag "${VERSION_TAG}"
133+ git tag "${TAG}"
134+ git push --tags
135+
136+ github-release release -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "${VERSION_TAG}" ${RELEASE_OPTS}
137+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-linux-amd64.deb" --file /tmp/workspace/dist-linux/c-pac_gui_*_amd64.deb
138+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-linux-amd64.snap" --file /tmp/workspace/dist-linux/c-pac_gui_*_amd64.snap
139+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-linux-amd64.tar.gz" --file /tmp/workspace/dist-linux/c-pac_gui-*.tar.gz
140+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-osx-amd64.dmg" --file /tmp/workspace/dist-macos/C-PAC-*.dmg
141+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-osx-amd64.zip" --file /tmp/workspace/dist-macos/C-PAC-*-mac.zip
142+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${VERSION_TAG}" --name "c-pac_gui-${VERSION_TAG}-browser.zip" --file /tmp/c-pac_gui-*-browser.zip
143+
144+ github-release release -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "${TAG}" ${RELEASE_OPTS}
145+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-linux-amd64.deb" --file /tmp/workspace/dist-linux/c-pac_gui_*_amd64.deb
146+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-linux-amd64.snap" --file /tmp/workspace/dist-linux/c-pac_gui_*_amd64.snap
147+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-linux-amd64.tar.gz" --file /tmp/workspace/dist-linux/c-pac_gui-*.tar.gz
148+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-osx-amd64.dmg" --file /tmp/workspace/dist-macos/C-PAC-*.dmg
149+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-osx-amd64.zip" --file /tmp/workspace/dist-macos/C-PAC-*-mac.zip
150+ github-release upload -u FCP-INDI -r C-PAC_GUI --tag "${TAG}" --name "c-pac_gui-${TAG}-browser.zip" --file /tmp/c-pac_gui-*-browser.zip
151+
152+ deploy-web :
153+ docker :
154+ - image : circleci/node:11.12.0
155+ environment :
156+ BASH_ENV : " .circleci/bashrc"
157+ steps :
158+ - checkout
159+ - attach_workspace :
160+ at : /tmp/workspace
76161 - run :
77162 name : Configure git user
78163 command : |
79164 git config --global user.email "ci-build@fcp-indi.github.com"
80165 git config --global user.name "ci-build"
81166 - run :
82- name : Build and deploy
167+ name : Deploy web-version
83168 command : |
84- VERSION=`jq -r '.version' package.json`
169+ VERSION=v`jq -r '.version' package.json`
170+ VERSION_TAG=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "${VERSION}" || echo "${VERSION}-rc")
171+ TAG=$([ "${CIRCLE_BRANCH}" == "master" ] && echo "latest" || echo "nightly")
172+
85173 git clone --single-branch --branch gh-pages git@github.com:FCP-INDI/C-PAC_GUI.git /tmp/repo
174+ cd /tmp/repo
86175
87- rm -Rf /tmp/repo/versions/$VERSION 2> /dev/null | true
88- mkdir -p /tmp/repo/versions/$VERSION
89- # mv /tmp/build-web /tmp/repo/versions/$VERSION/web
90- mv /tmp/build-electron /tmp/repo/versions/$VERSION/electron
176+ rm -Rf /tmp/repo/versions/${VERSION_TAG} 2> /dev/null | true
177+ mkdir -p /tmp/repo/versions/${VERSION_TAG}
178+ cp -Rf /tmp/workspace/dist-web-browser /tmp/repo/versions/${VERSION_TAG}/browser
179+ cp -Rf /tmp/workspace/dist-web-electron /tmp/repo/versions/${VERSION_TAG}/electron
180+
181+ if [ "${CIRCLE_BRANCH}" == "master" ]; then
182+ find . -maxdepth 1 ! -name '.git' ! -name 'versions' ! -name 'versions.txt' ! -name '.' -delete
183+ cp -Rf /tmp/workspace/dist-web-browser/* /tmp/repo
184+ fi
185+
186+ rm -Rf /tmp/repo/versions/${TAG} 2> /dev/null | true
187+ mkdir -p /tmp/repo/versions/${TAG}
188+ cp -Rf /tmp/workspace/dist-web-browser /tmp/repo/versions/${TAG}/browser
189+ cp -Rf /tmp/workspace/dist-web-electron /tmp/repo/versions/${TAG}/electron
190+
191+ ls -1 /tmp/repo/versions > /tmp/repo/versions.txt
91192
92- cd /tmp/repo
93193 git add .
94- git commit -m "updates"
95- git push -f origin gh-pages
194+ git commit -m "updates" || true
195+ git push -f origin gh-pages || true
96196
97197workflows :
98198 version : 2
99199 build :
100200 jobs :
101-
102- # - build-linux
103- # - build-macos:
104- # context: c-pac_gui
105- # - deploy:
106- - deploy
107- # requires:
108- # - build-linux
109- # - build-macos
201+ - build-linux :
202+ filters :
203+ branches :
204+ ignore : gh-pages
205+ - build-macos :
206+ filters :
207+ branches :
208+ ignore : gh-pages
209+ context : c-pac_gui
210+ - build-web :
211+ filters :
212+ branches :
213+ ignore : gh-pages
214+ - deploy-releases :
215+ filters :
216+ branches :
217+ only :
218+ - master
219+ - develop
220+ requires :
221+ - build-linux
222+ - build-macos
223+ - build-web
224+ - deploy-web :
225+ filters :
226+ branches :
227+ only :
228+ - master
229+ - develop
230+ requires :
231+ - build-web
0 commit comments