File tree Expand file tree Collapse file tree 2 files changed +54
-16
lines changed Expand file tree Collapse file tree 2 files changed +54
-16
lines changed Original file line number Diff line number Diff line change 1
1
version : 2
2
2
jobs :
3
- test :
3
+ build :
4
4
machine : true
5
5
working_directory : ~/project
6
6
steps :
9
9
name : Build docker image
10
10
command : |
11
11
docker build -t react-native-community/react-native .
12
- - run :
13
- name : Test Avd
14
- command : |
15
- docker run --rm --name rn-build -v $PWD:/pwd -w /pwd react-native-community/react-native bash -c \
16
- "chmod +x ./test-avd.sh && ./test-avd.sh"
17
- - run :
18
- name : Test react-native repo
19
- command : |
20
- git clone https://github.com/facebook/react-native --depth=1
21
- cd react-native
22
- docker run --rm --name rn-build -v $PWD:/pwd -w /pwd react-native-community/react-native bash -c \
23
- "yarn install && ./gradlew RNTester:android:app:assembleRelease && ./scripts/circleci/buck_fetch.sh"
24
12
- run :
25
13
name : Docker info
26
14
command : |
27
- docker run --rm --name rn-env react-native-community/react-native bash -c "npm i -g envinfo && envinfo"
15
+ docker run --rm --name rn-env react-native-community/react-native bin/sh -c "npx envinfo"
16
+ test :
17
+ - run :
18
+ name : Test
19
+ command : |
20
+ git clone https://github.com/facebook/react-native --depth=1
21
+ cd react-native
22
+ docker run --rm --name rn-build -v $PWD:/pwd -w /pwd react-native-community/react-native /bin/sh -c \
23
+ "yarn install && ./gradlew RNTester:android:app:assembleRelease && ./scripts/circleci/buck_fetch.sh"
24
+ deploy :
25
+ - run :
26
+ name : Deploy docker
27
+ command : |
28
+ source ~/.bashrc
29
+ nvm i node
30
+ node publish_docker.js
28
31
29
32
workflows :
30
33
version : 2
31
- perfs :
34
+ main :
32
35
jobs :
33
- - test
36
+ - build
37
+ - test :
38
+ requires :
39
+ - build
40
+ - deploy :
41
+ requires :
42
+ - build
43
+ filters :
44
+ branches :
45
+ only : master
Original file line number Diff line number Diff line change
1
+ const execSync = require ( "child_process" ) . execSync ;
2
+
3
+ function publishDocker ( ) {
4
+ const now = new Date ( )
5
+ const repo = `reactnativecommunity/react-native-android`
6
+ const finaltag = `${ now . getFullYear ( ) } -${ now . getMonth ( ) + 1 } -${ now . getDate ( ) } `
7
+ const cmd = `
8
+ docker login -u ${ process . env . DOCKER_USER } -p ${ process . env . DOCKER_PASS }
9
+ docker build -t ${ repo } :${ finaltag } .
10
+ docker tag ${ repo } :${ finaltag } ${ repo }
11
+ docker push ${ repo } :${ finaltag }
12
+ docker push ${ repo }
13
+ `
14
+ cmd . trim ( ) . split ( "\n" ) . map ( i => {
15
+ const cmd = i . trim ( ) ;
16
+ if ( cmd ) {
17
+ if ( ! cmd . includes ( 'login' ) ) {
18
+ console . log ( cmd ) ;
19
+ }
20
+ const output = execSync ( cmd )
21
+ console . log ( output . toString ( ) ) ;
22
+ }
23
+ } )
24
+ }
25
+
26
+ publishDocker ( )
You can’t perform that action at this time.
0 commit comments