Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed May 17, 2021
2 parents d08d0c7 + 087205d commit 4d18304
Show file tree
Hide file tree
Showing 160 changed files with 15,380 additions and 11,434 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
name: Standard issue template
about: A standard template to follow when creating a new issue in this repository
labels: AutoAssignerTriage
---

Expand Down
32 changes: 8 additions & 24 deletions .github/actions/bumpVersion/bumpVersion.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
const {promisify} = require('util');
const fs = require('fs');
const exec = promisify(require('child_process').exec);
const _ = require('underscore');
const core = require('@actions/core');
const github = require('@actions/github');
const versionUpdater = require('../../libs/versionUpdater');
const {updateAndroidVersion, updateiOSVersion, generateAndroidVersionCode} = require('../../libs/nativeVersionUpdater');

let newVersion;

/**
* Update the native app versions.
*
Expand Down Expand Up @@ -42,37 +40,23 @@ function updateNativeVersions(version) {
}
}

const octokit = github.getOctokit(core.getInput('GITHUB_TOKEN', {required: true}));
let semanticVersionLevel = core.getInput('SEMVER_LEVEL', {require: true});

if (!semanticVersionLevel || !_.find(versionUpdater.SEMANTIC_VERSION_LEVELS, v => v === semanticVersionLevel)) {
if (!semanticVersionLevel || !_.contains(versionUpdater.SEMANTIC_VERSION_LEVELS, semanticVersionLevel)) {
console.log(
`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`,
`Defaulting to: ${versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD}`,
);
semanticVersionLevel = versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD;
}
console.log('Fetching tags from github...');
octokit.repos.listTags({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
})
.catch(githubError => core.setFailed(githubError))
.then((githubResponse) => {
// Find the highest version git tag
const tags = githubResponse.data.map(tag => tag.name);

// tags come from latest to oldest
const highestVersion = tags[0];
const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json'));
const newVersion = versionUpdater.incrementVersion(previousVersion, semanticVersionLevel);
console.log(`Previous version: ${previousVersion}`, `New version: ${newVersion}`);

console.log(`Highest version found: ${highestVersion}.`);
updateNativeVersions(newVersion);

newVersion = versionUpdater.incrementVersion(highestVersion, semanticVersionLevel);

updateNativeVersions(newVersion);
console.log(`Setting npm version for this PR to ${newVersion}`);
return exec(`npm --no-git-tag-version version ${newVersion} -m "Update version to ${newVersion}"`);
})
console.log(`Setting npm version to ${newVersion}`);
exec(`npm --no-git-tag-version version ${newVersion} -m "Update version to ${newVersion}"`)
.then(({stdout}) => {
// NPM and native versions successfully updated, output new version
console.log(stdout);
Expand Down
Loading

0 comments on commit 4d18304

Please sign in to comment.