Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(releases): creating releases in git backend #6854

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jessevanmuijden
Copy link

@jessevanmuijden jessevanmuijden commented Jul 25, 2023

This pull request implements this suggestion.

Closes #6884

Summary
Navigate to releases. When you do not have any releases published to your git repository, click the "Create first release" button. Then, Decap will create a release with tag v0.0.0 in your git repository. When your git repository contains releases, the Releases page displays the latest release version and lists all releases. Also, buttons for bumping the major, minor and patch version will be displayed. Clicking any of these buttons will create a release on the default branch of your git repository that is tagged with the bumped version. This allows you to trigger builds and deploys on tags, as opposed to any commit on your default branch, offering more control and using fewer resources.

Motivation
On different hosting providers, like Cloudflare, the number of builds on the free plan is limited. Without editorial workflow, Decap pushes a commit to the main branch every time a user clicks the Publish button on the CMS. In turn, this triggers a build and deploy of the website which is resource intensive. Builds and deploys can be configured to be triggered by a newly pushed tag. Being able to publish a release with a tag from Decap, gives you more control over when your site is built and deployed. As a next step, it would be possible to add pre-releases support, to create preview app deployments on demand, that will allow you to preview a set of changes in the context of your entire site, instead of the - limited - preview window of the CMS.

Test plan

to do

Checklist

  • React components
  • Styling
  • Improve error handling
  • Types
  • Tests
  • GitLab implementation
  • Azure implementation
  • Bitbucket implementation
  • I have read the contribution guidelines.

POC implementation

releases-2.mov

@jessevanmuijden jessevanmuijden force-pushed the feat/creating-releases branch 2 times, most recently from 83c404c to ba158f4 Compare July 27, 2023 13:04
@martinjagodic martinjagodic linked an issue Aug 25, 2023 that may be closed by this pull request
@martinjagodic martinjagodic requested a review from demshy August 25, 2023 08:14
Copy link

@xaiki xaiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great feature to add,
here's my review, note that i'm not part of the decap team.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably not link to your repo

@@ -1449,6 +1479,7 @@ export default class API {
author?: GitHubAuthor,
committer?: GitHubCommitter,
) {
console.log(message);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it should either be removed or switched to the logging format.

return;
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest of the code prefers the .then() syntax, you should probably respect that and write it as:

return await this.api!.listReleases().catch(e => ([]))

);

return this.request(`${this.repoURL}/releases`)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may want to do error handeling here ?

return this.request(`${this.repoURL}/releases`, {
method: 'POST',
body: JSON.stringify({ tag_name: version }),
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -43,10 +43,10 @@
"jwt-decode": "^3.0.0",
"node-polyglot": "^2.3.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react": "^16.8.4 || ^17.0.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably justify this react deps bump

"react-dnd": "^14.0.0",
"react-dnd-html5-backend": "^14.0.0",
"react-dom": "^16.8.4",
"react-dom": "^16.8.4 || ^17.0.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -71,6 +71,7 @@
"remark-gfm": "1.0.0",
"sanitize-filename": "^1.6.1",
"semaphore": "^1.0.5",
"semver": "^7.5.4",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document why you want semver

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to conveniently bump the version. will document

@@ -205,6 +208,7 @@ class App extends React.Component {
to={defaultPath}
/>
{hasWorkflow ? <Route path="/workflow" component={Workflow} /> : null}
{isGitBackend ? <Route path="/releases" component={Releases}/> : null }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to only work for github, is checking isGitBackend() enough to ensure we're in GitHub land ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to add implementations for the other providers.

@nioc
Copy link

nioc commented Nov 17, 2023

Thanks for this PR which handle a very interesting feature.
It seems that more than a month passed since last update, any new?
@demshy does this feature will be merged?

@martinjagodic
Copy link
Member

@nioc this is waiting for @jessevanmuijden as it's his idea and PR. If you want this to move faster, you are welcome to contribute too.

@nioc
Copy link

nioc commented Nov 20, 2023

No hurry, I thought the developments were finished and all that remained was to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tagging releases
4 participants