Skip to content
39 changes: 39 additions & 0 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
steps:
- block: ":rocket: Release!"
prompt: "Fill out the details for release"
if: 'build.message =~ /^release\$/i'
fields:
- text: "VERSION"
key: "version"
- text: "NPM_TAG"
key: "npm-tag"
default: 'null'
hint: 'Leave NULL if no version is specified'
required: false

- label: "Android"
command:
- "nvm install"
- "npm install"
- "npm run test-js"
- "npm run clean"
- "npm run test-unit-android -- --release"
key: android

- label: "iOS"
command:
- "nvm install"
- "npm install"
- "npm run test-unit-ios -- --release"
- "npm run test-e2e-ios -- --release --multi"
key: ios

- label: ":package: Publish"
if: "build.pull_request.id == null"
command:
- "nvm install"
- "npm install"
- "npm run release"
depends_on:
- "android"
- "ios"
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@types/react-native": "0.66.12",
"@types/react-test-renderer": "16.9.2",
"babel-eslint": "10.0.3",
"detox": "^17.5.7",
"detox": "^19.4.2",
"github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58",
"jest": "24.9.0",
"lodash": "4.17.21",
Expand Down
29 changes: 16 additions & 13 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ const semver = require('semver');
const fs = require('fs');
const _ = require('lodash');
const grenrc = require('../.grenrc');
const cp = require('child_process');

// Workaround JS
const isRelease = process.env.RELEASE_BUILD === 'true';
const isRelease = process.env.BUILDKITE_MESSAGE.match(/^release$/i);
const BRANCH = process.env.BUILDKITE_BRANCH;

const BRANCH = process.env.BRANCH;
const VERSION_TAG = process.env.NPM_TAG || isRelease ? 'latest' : 'snapshot';
let VERSION, VERSION_TAG;
if (isRelease) {
VERSION = cp.execSync(`buildkite-agent meta-data get version`).toString();
VERSION_TAG = cp.execSync(`buildkite-agent meta-data get npm-tag`).toString();
}

if (VERSION_TAG == 'null') {
VERSION_TAG = isRelease ? 'latest' : 'snapshot';
}
const VERSION_INC = 'patch';

function run() {
Expand All @@ -22,15 +31,9 @@ function run() {
}

function validateEnv() {
if (!process.env.JENKINS_CI) {
if (!process.env.CI) {
throw new Error(`releasing is only available from CI`);
}

if (!process.env.JENKINS_MASTER) {
console.log(`not publishing on a different build`);
return false;
}

return true;
}

Expand Down Expand Up @@ -60,10 +63,10 @@ function versionTagAndPublish() {
console.log(`current published version: ${currentPublished}`);

const version = isRelease
? process.env.VERSION
? VERSION
: semver.gt(packageVersion, currentPublished)
? `${packageVersion}-snapshot.${process.env.BUILD_ID}`
: `${currentPublished}-snapshot.${process.env.BUILD_ID}`;
? `${packageVersion}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`
: `${currentPublished}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`;

console.log(`Publishing version: ${version}`);

Expand Down