Skip to content

Commit 43a48d5

Browse files
authored
Revert "remove Circle CI, publish updates latest tag" (#143)
1 parent 0edb7eb commit 43a48d5

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.circleci/config.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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

.github/workflows/publish.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ jobs:
2424
- name: Prepare tags
2525
env:
2626
DOCKER_IMAGE: reactnativecommunity/react-native-android
27+
STABLE_MAJOR: 1
2728
id: tags
2829
run: |
2930
VERSION=${GITHUB_REF#refs/tags/v}
3031
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
3236
echo ::set-output name=tags::${TAGS}
37+
3338
- name: Build & publish to Docker Hub
3439
uses: docker/build-push-action@v2
3540
with:

publish_docker.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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()

0 commit comments

Comments
 (0)