Skip to content

Commit

Permalink
check in prod dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed May 27, 2020
1 parent 1ba75e9 commit 76703c2
Show file tree
Hide file tree
Showing 2,782 changed files with 414,939 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
__tests__/runner/*

# comment out in distribution branches
node_modules/
lib/
# node_modules/
# lib/

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down
154 changes: 154 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const exec_1 = require("@actions/exec");
const github_1 = require("@actions/github");
const semver_1 = require("semver");
const commit_analyzer_1 = require("@semantic-release/commit-analyzer");
const release_notes_generator_1 = require("@semantic-release/release-notes-generator");
const SEPARATOR = "==============================================";
function exec(command) {
return __awaiter(this, void 0, void 0, function* () {
let stdout = "";
let stderr = "";
try {
const options = {
listeners: {
stdout: (data) => {
stdout += data.toString();
},
stderr: (data) => {
stderr += data.toString();
},
},
};
const code = yield exec_1.exec(command, undefined, options);
return {
code,
stdout,
stderr,
};
}
catch (err) {
return {
code: 1,
stdout,
stderr,
error: err,
};
}
});
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const defaultBump = core.getInput("default_bump");
const tagPrefix = core.getInput("tag_prefix");
const releaseBranches = core.getInput("release_branches");
const createAnnotatedTag = core.getInput("create_annotated_tag");
const dryRun = core.getInput("dry_run");
const { GITHUB_REF, GITHUB_SHA } = process.env;
if (!GITHUB_REF) {
core.setFailed("Missing GITHUB_REF");
return;
}
if (!GITHUB_SHA) {
core.setFailed("Missing GITHUB_SHA");
return;
}
const preRelease = releaseBranches
.split(",")
.every((branch) => !GITHUB_REF.replace("refs/heads/", "").match(branch));
yield exec("git fetch --tags");
const hasTag = !!(yield exec("git tag")).stdout.trim();
let tag = "";
let logs = "";
if (hasTag) {
const previousTagSha = (yield exec("git rev-list --tags --topo-order --max-count=1")).stdout.trim();
tag = (yield exec(`git describe --tags ${previousTagSha}`)).stdout.trim();
logs = (yield exec(`git log ${tag}..HEAD --pretty=format:'%s%n%b${SEPARATOR}' --abbrev-commit`)).stdout.trim();
core.debug(`Setting previous_tag to: ${tag}`);
core.setOutput("previous_tag", tag);
if (previousTagSha === GITHUB_SHA) {
core.debug("No new commits since previous tag. Skipping...");
return;
}
}
else {
tag = "0.0.0";
logs = (yield exec(`git log --pretty=format:'%s%n%b${SEPARATOR}' --abbrev-commit`)).stdout.trim();
core.setOutput("previous_tag", tag);
}
// for some reason the commits start and end with a `'` on the CI so we ignore it
const commits = logs
.split(SEPARATOR)
.map((x) => ({
message: x.trim().replace(/^'\n'/g, "").replace(/^'/g, ""),
}))
.filter((x) => !!x.message);
const bump = yield commit_analyzer_1.analyzeCommits({}, { commits, logger: { log: console.info.bind(console) } });
if (!bump && defaultBump === "false") {
core.debug("No commit specifies the version bump. Skipping...");
return;
}
const newVersion = `${semver_1.inc(tag, bump || defaultBump)}${preRelease ? `-${GITHUB_SHA.slice(0, 7)}` : ""}`;
const newTag = `${tagPrefix}${newVersion}`;
core.setOutput("new_version", newVersion);
core.setOutput("new_tag", newTag);
core.debug(`New tag: ${newTag}`);
const changelog = yield release_notes_generator_1.generateNotes({}, {
commits,
logger: { log: console.info.bind(console) },
options: {
repositoryUrl: `https://github.com/${process.env.GITHUB_REPOSITORY}`,
},
lastRelease: { gitTag: tag },
nextRelease: { gitTag: newTag, version: newVersion },
});
core.setOutput("changelog", changelog);
if (preRelease) {
core.debug("This branch is not a release branch. Skipping the tag creation.");
return;
}
const tagAlreadyExists = !!(yield exec(`git tag -l "${newTag}"`)).stdout.trim();
if (tagAlreadyExists) {
core.debug("This tag already exists. Skipping the tag creation.");
return;
}
if (/true/i.test(dryRun)) {
core.info("Dry run: not performing tag action.");
return;
}
const octokit = new github_1.GitHub(core.getInput("github_token"));
if (createAnnotatedTag === "true") {
core.debug(`Creating annotated tag`);
const tagCreateResponse = yield octokit.git.createTag(Object.assign(Object.assign({}, github_1.context.repo), { tag: newTag, message: newTag, object: GITHUB_SHA, type: "commit" }));
core.debug(`Pushing annotated tag to the repo`);
yield octokit.git.createRef(Object.assign(Object.assign({}, github_1.context.repo), { ref: `refs/tags/${newTag}`, sha: tagCreateResponse.data.sha }));
return;
}
core.debug(`Pushing new tag to the repo`);
yield octokit.git.createRef(Object.assign(Object.assign({}, github_1.context.repo), { ref: `refs/tags/${newTag}`, sha: GITHUB_SHA }));
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
1 change: 1 addition & 0 deletions node_modules/.bin/JSONStream

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/conventional-changelog-writer

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/conventional-commits-parser

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/handlebars

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uglifyjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

146 changes: 146 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76703c2

Please sign in to comment.