forked from react-native-elements/react-native-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
14,711 additions
and
4,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Configure user | ||
git config --global user.name "React Native Elements CI" | ||
echo -e "machine github.com\n login react-native-elements-ci\n password $GITHUB_TOKEN" >> ~/.netrc | ||
|
||
# Expo auto deployment for PRs | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_PULL_REQUEST_SLUG" == "react-native-training/react-native-elements" ]; then | ||
set -x | ||
|
||
# Clone example app and install modules | ||
git clone "https://github.com/react-native-training/react-native-elements-app.git" | ||
cd react-native-elements-app | ||
yarn add "https://github.com/${TRAVIS_PULL_REQUEST_SLUG}.git#${TRAVIS_PULL_REQUEST_SHA}" | ||
yarn | ||
yarn global add exp | ||
|
||
# Login into expo and publish the example app | ||
set +x | ||
exp login -u "$EXPO_LOGIN" -p "$EXPO_PASSWORD" --non-interactive | ||
set -x | ||
exp publish --release-channel ${TRAVIS_PULL_REQUEST_SHA} | ||
|
||
# Comment the PR | ||
cd ../.ci | ||
yarn | ||
node index.js | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const octokit = require('@octokit/rest')() | ||
|
||
const TRAVIS_PULL_REQUEST = process.env.TRAVIS_PULL_REQUEST | ||
const TRAVIS_PULL_REQUEST_SHA = process.env.TRAVIS_PULL_REQUEST_SHA | ||
const owner = 'react-native-training' | ||
const repo = 'react-native-elements' | ||
|
||
async function commentPullRequest() { | ||
// Synchronous, just set the credentials | ||
octokit.authenticate({ | ||
type: 'token', | ||
token: process.env.GITHUB_TOKEN, | ||
}) | ||
|
||
// Get the comments of the pull request | ||
const result = await octokit.issues.getComments({ | ||
owner, | ||
repo, | ||
page: 1, | ||
number: TRAVIS_PULL_REQUEST, | ||
per_page: 100 // This is the maximum. Hopefully, the CI comment should be there | ||
}) | ||
|
||
// Set the body of the comment | ||
const expo_url = `https://exp.host/@rn-elements/react-native-elements-app?release-channel=${TRAVIS_PULL_REQUEST_SHA}` | ||
const qr_code_url = `![QR Code](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${expo_url})` | ||
const body = `Example app for the last commit (${TRAVIS_PULL_REQUEST_SHA}):\n\n${qr_code_url}\n\n${expo_url}` | ||
|
||
// If there is already a CI comment, just update it, if no, comment the PR | ||
const comment = result.data.find(comment => comment.user.login === 'react-native-elements-ci'); | ||
if (comment != null) { | ||
// Update comment | ||
const result = await octokit.issues.editComment({ | ||
owner, | ||
repo, | ||
id: comment.id, | ||
body, | ||
}) | ||
console.log(`Updated comment #${comment.id}`) | ||
} | ||
else { | ||
// Post new comment | ||
const result = await octokit.issues.createComment({ | ||
owner, | ||
repo, | ||
number: TRAVIS_PULL_REQUEST, | ||
body, | ||
}) | ||
console.log("Posted new comment") | ||
} | ||
} | ||
|
||
commentPullRequest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "react-native-elements-ci", | ||
"version": "1.0.0", | ||
"description": "Script for CI on React Native Elements ", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@octokit/rest": "15.2.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ site | |
coverage | ||
jsconfig.json | ||
.vscode/ | ||
.idea/ | ||
website/build | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
package.json | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.