Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
fix(release-please): uses factory from latest version (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmaticivan committed Feb 15, 2021
1 parent 9c12678 commit cede8e4
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 227 deletions.
30 changes: 9 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const core = require('@actions/core')
const { GitHubRelease } = require('release-please/build/src/github-release')
const { ReleasePR } = require('release-please/build/src/release-pr')
const { factory } = require('release-please/build/src')

const RELEASE_LABEL = 'autorelease: pending'
const GITHUB_RELEASE_COMMAND = 'github-release'
const GITHUB_RELEASE_PR_COMMAND = 'release-pr'

async function main () {
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
Expand All @@ -26,9 +27,8 @@ async function main () {

// First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"):
if (!command || command === 'github-release') {
const Release = releasePlease.getGitHubRelease()
const gr = new Release({
if (!command || command === GITHUB_RELEASE_COMMAND) {
const releaseCreated = await factory.runCommand(GITHUB_RELEASE_COMMAND, {
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
packageName,
Expand All @@ -39,7 +39,7 @@ async function main () {
releaseType,
defaultBranch
})
const releaseCreated = await gr.run()

if (releaseCreated) {
core.setOutput('release_created', true)
for (const key of Object.keys(releaseCreated)) {
Expand All @@ -50,9 +50,8 @@ async function main () {

// Next we check for PRs merged since the last release, and groom the
// release PR:
if (!command || command === 'release-pr') {
const GithubReleasePR = releasePlease.getReleasePR()
const release = new GithubReleasePR({
if (!command || command === GITHUB_RELEASE_PR_COMMAND) {
const pr = await factory.runCommand(GITHUB_RELEASE_PR_COMMAND, {
releaseType,
monorepoTags,
packageName,
Expand All @@ -68,25 +67,14 @@ async function main () {
defaultBranch
})

const pr = await release.run()
if (pr) {
core.setOutput('pr', pr)
}
}
}

function getGitHubRelease () {
return GitHubRelease
}

function getReleasePR () {
return ReleasePR
}

const releasePlease = {
main,
getGitHubRelease,
getReleasePR
main
}

if (require.main === module) {
Expand Down
62 changes: 34 additions & 28 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"homepage": "https://github.com/bcoe/release-please-action#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"release-please": "^10.1.0"
"release-please": "11.0.0-candidate.1"
},
"devDependencies": {
"@vercel/ncc": "^0.27.0",
Expand Down
Loading

0 comments on commit cede8e4

Please sign in to comment.