|
| 1 | +# jQuery Project Release Automation |
| 2 | + |
| 3 | +This script automates releases for all jQuery projects. It is designed to create |
| 4 | +consistency between projects and reduce the burden of maintaining individual |
| 5 | +release scripts. |
| 6 | + |
| 7 | +## Creating a Release |
| 8 | + |
| 9 | +Creating a release is as simple as cloning this repository and telling the |
| 10 | +script which project to use. In order to ensure a clean and proper release is |
| 11 | +created, you should always start from a new clone of this repository. |
| 12 | + |
| 13 | +```sh |
| 14 | +git clone git@github.com:jquery/jquery-release.git |
| 15 | +cd jquery-release |
| 16 | +node jquery-release.js --remote=jquery/<project-name> |
| 17 | +``` |
| 18 | + |
| 19 | +### Testing the Release Script |
| 20 | + |
| 21 | +You can do a test run of the release script by using a different remote |
| 22 | +repository. The script is smart enough to detect if you're using an |
| 23 | +official repository and adjust which actions are taken so that undesired |
| 24 | +actions, such as publishing to npm, don't occur for test runs. |
| 25 | + |
| 26 | +### Full Usage Options |
| 27 | + |
| 28 | +See the [usage documenation](/docs/usage.txt) for the full set of options. |
| 29 | +You can also run the script with no parameters to see the usage. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +## Creating a Project-Specific Release Script |
| 34 | + |
| 35 | +This script only performs the set of common functionality across all projects. |
| 36 | +Each project may have additional functionality. Any project-specific |
| 37 | +configuration and functionality must be defined in the `build/release.js` file |
| 38 | +inside the project's repository. |
| 39 | + |
| 40 | +Here's a minimal example: |
| 41 | + |
| 42 | +```js |
| 43 | +module.exports = function( Release ) { |
| 44 | + |
| 45 | +Release.define({ |
| 46 | + issueTracker: "trac", |
| 47 | + contributorReportId: 37, |
| 48 | + changelogShell: function() { |
| 49 | + return "# Amazing Changelog for v" + Release.newVersion + "\n"; |
| 50 | + } |
| 51 | +}); |
| 52 | + |
| 53 | +}; |
| 54 | +``` |
| 55 | + |
| 56 | +### Required/Recommended Configuration |
| 57 | + |
| 58 | +#### checkRepoState() |
| 59 | + |
| 60 | +Performs any project-specific checks to ensure the repository is in a good state |
| 61 | +to be released. For example, there is a built-in check to ensure that |
| 62 | +AUTHORS.txt is up-to-date. |
| 63 | + |
| 64 | +This method has no return value. If a project-specific check fails, the script |
| 65 | +should use `Release.abort()` to prevent the release from continuing. |
| 66 | + |
| 67 | +#### generateArtifacts( callback ) |
| 68 | + |
| 69 | +Generates any release artifacts that should be included in the release. The |
| 70 | +callback must be invoked with an array of files that should be committed before |
| 71 | +creating the tag. |
| 72 | + |
| 73 | +#### changelogShell() |
| 74 | + |
| 75 | +Defines the shell for the changelog. The changelog is created by concatenating |
| 76 | +the shell, the commit log, and the issue list. |
| 77 | + |
| 78 | +#### issueTracker |
| 79 | + |
| 80 | +Which type of issue tracker is being used for the project. Must be either |
| 81 | +`"trac"` or `"github"`. |
| 82 | + |
| 83 | +#### contributorReportId |
| 84 | + |
| 85 | +If using Trac, this defines which report will produce a list of contributors |
| 86 | +for a specific release. |
| 87 | + |
| 88 | +See [docs/track-contributors.sql](docs/track-contributors.sql) for the SQL |
| 89 | +necessary to create the Trac report. |
| 90 | + |
| 91 | +### Other Methods |
| 92 | + |
| 93 | +#### define( props ) |
| 94 | + |
| 95 | +Defines new properties and methods to add to the `Release` object. |
| 96 | + |
| 97 | +#### abort( msg ) |
| 98 | + |
| 99 | +Aborts the release and prints the message. |
| 100 | + |
| 101 | +#### exec( command, options ) |
| 102 | + |
| 103 | +Executes the given `command`. You can pass `{ silent: true }` to suppress output |
| 104 | +on the command line. |
| 105 | + |
| 106 | +Returns the output. |
| 107 | + |
| 108 | +#### git( command, errorMessage ) |
| 109 | + |
| 110 | +Executes the given git `command`. If the command fails, the release will be |
| 111 | +aborted and `errorMessage` will be displayed. |
| 112 | + |
| 113 | +#### gitLog( format ) |
| 114 | + |
| 115 | +Gets a git log using the specified format. If the log fails, the release will be |
| 116 | +aborted. |
| 117 | + |
| 118 | +Returns an array of commits. |
| 119 | + |
| 120 | +#### prompt( callback ) |
| 121 | + |
| 122 | +Prompts the user for input. |
| 123 | + |
| 124 | +Passes the input to `callback`. |
| 125 | + |
| 126 | +#### confirm( callback ) |
| 127 | + |
| 128 | +Prompts the user to confirm they want to continue with the release script. If |
| 129 | +the user decides not to continue, the release will be aborted and `callback` |
| 130 | +won't be invoked. |
| 131 | + |
| 132 | +#### confirmReview( callback ) |
| 133 | + |
| 134 | +Prompts the user to review the output and confirm they want to continue with the |
| 135 | +release script. If the user decides not to continue, the release will be aborted |
| 136 | +and `callback` won't be invoked. |
| 137 | + |
| 138 | +#### trac( path ) |
| 139 | + |
| 140 | +Gets the results of a Trac query, with tab-delimited results. |
| 141 | + |
| 142 | +Returns the tab-delimited string. |
| 143 | + |
| 144 | +#### readPackage() |
| 145 | + |
| 146 | +Gets the contents of `package.json` as an object. |
| 147 | + |
| 148 | +#### writePackage( package ) |
| 149 | + |
| 150 | +Saves `package` to `package.json`, preserving indentation style. |
| 151 | + |
| 152 | +### Other Properties |
| 153 | + |
| 154 | +#### isTest |
| 155 | + |
| 156 | +Whether this is a test release. |
| 157 | + |
| 158 | +#### project |
| 159 | + |
| 160 | +The name of the project being released. |
| 161 | + |
| 162 | +#### remote |
| 163 | + |
| 164 | +The location of the remote repository. |
| 165 | + |
| 166 | +#### preRelease |
| 167 | + |
| 168 | +The version number for a pre-release version, or `false` for stable releases. |
| 169 | + |
| 170 | +#### dir.base |
| 171 | + |
| 172 | +The main directory used for the release script. |
| 173 | + |
| 174 | +#### dir.repo |
| 175 | + |
| 176 | +The directory for the local repository. |
| 177 | + |
| 178 | +#### newVersion |
| 179 | + |
| 180 | +The version being released. |
| 181 | + |
| 182 | +#### prevVersion |
| 183 | + |
| 184 | +The previous release version (used for determining what changed). |
| 185 | + |
| 186 | +#### nextVersion |
| 187 | + |
| 188 | +The version that will be set in `package.json` after the release. |
| 189 | + |
| 190 | +#### tagTime |
| 191 | + |
| 192 | +Timestamp for the release tag. |
| 193 | + |
| 194 | +#### branch |
| 195 | + |
| 196 | +Which branch the release is being generated from. |
0 commit comments