File tree 3 files changed +64
-1
lines changed
3 files changed +64
-1
lines changed Original file line number Diff line number Diff line change
1
+ version : 2
2
+
3
+ defaults : &defaults
4
+ machine : true
5
+ working_directory : ~/project
6
+
7
+ aliases :
8
+ - &build-docker
9
+ name : Build Docker Image
10
+ command : |
11
+ docker build -t react-native-community/react-native .
12
+ docker run --rm --name rn-env react-native-community/react-native bin/sh -c "npx envinfo"
13
+
14
+ jobs :
15
+
16
+ deploy :
17
+ << : *defaults
18
+ steps :
19
+ - checkout
20
+ - run : *build-docker
21
+ - run :
22
+ name : Deploy docker
23
+ command : |
24
+ source ~/.bashrc
25
+ nvm i node
26
+ node publish_docker.js
27
+
28
+ workflows :
29
+ version : 2
30
+ main :
31
+ jobs :
32
+ - deploy :
33
+ filters :
34
+ branches :
35
+ only : master
Original file line number Diff line number Diff line change @@ -24,12 +24,17 @@ jobs:
24
24
- name : Prepare tags
25
25
env :
26
26
DOCKER_IMAGE : reactnativecommunity/react-native-android
27
+ STABLE_MAJOR : 1
27
28
id : tags
28
29
run : |
29
30
VERSION=${GITHUB_REF#refs/tags/v}
30
31
MAJOR=$(echo $VERSION | cut -d'.' -f 1)
31
- TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:$MAJOR,$DOCKER_IMAGE:latest"
32
+ TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:$MAJOR"
33
+ if [[ $MAJOR == $STABLE_MAJOR ]]; then
34
+ TAGS="$TAGS,$DOCKER_IMAGE:latest"
35
+ fi
32
36
echo ::set-output name=tags::${TAGS}
37
+
33
38
- name : Build & publish to Docker Hub
34
39
uses : docker/build-push-action@v2
35
40
with :
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 cmd = `
7
+ docker login -u ${ process . env . DOCKER_USER } -p ${ process . env . DOCKER_PASS }
8
+ docker build -t ${ repo } .
9
+ docker push ${ repo }
10
+ `
11
+ cmd . trim ( ) . split ( "\n" ) . map ( i => {
12
+ const cmd = i . trim ( ) ;
13
+ if ( cmd ) {
14
+ if ( ! cmd . includes ( 'login' ) ) {
15
+ console . log ( cmd ) ;
16
+ }
17
+ const output = execSync ( cmd )
18
+ console . log ( output . toString ( ) ) ;
19
+ }
20
+ } )
21
+ }
22
+
23
+ publishDocker ( )
You can’t perform that action at this time.
0 commit comments