2023-11-10 15:24:48 +00:00
# Release Post Generator CLI tool
2022-09-06 03:51:28 +00:00
This is a cli tool designed to generate draft release posts for WooCommerce.
2024-04-09 08:50:15 +00:00
Posts generated via the tool will be draft posted to < https: / / developer . woocommerce . com > .
2022-09-06 03:51:28 +00:00
You can also generate an HTML representation of the post if you
2023-01-23 14:31:59 +00:00
don't have access to a WordPress.com auth token.
2022-09-06 03:51:28 +00:00
2023-11-10 15:24:48 +00:00
## Setup
2022-09-06 03:51:28 +00:00
1. Make sure `pnpm i` has been run in the monorepo.
2. Make sure you have added a `.env` file with the env variables set. WCCOM_TOKEN is optional if you're using `--outputOnly` , but
2023-08-01 01:47:10 +00:00
the `GITHUB_ACCESS_TOKEN` is required. If you need help generating a token see [the docs ](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token ). To silence all CLI output, set `LOGGER_LEVEL` to `"silent"` .
2022-09-10 21:55:53 +00:00
3. Note that the env file should live at the same path that you're running the command from.
2023-11-28 22:50:43 +00:00
4. Run the tool via the npm script, e.g. `pnpm release-post release "6.8.0" --outputOnly`
5. For more help on individual options, run the help `pnpm release-post <command> --help` . e.g. `pnpm release-post rc --help`
2023-08-01 01:47:10 +00:00
2023-11-10 15:24:48 +00:00
## Publishing Draft Posts
2022-09-06 03:51:28 +00:00
2024-04-09 08:50:15 +00:00
This tool will publish draft posts to `https://developer.woocommerce.com` for you if you omit the `--outputOnly` flag. There is some minimal first time setup for this though:
2022-09-06 03:51:28 +00:00
2023-01-23 14:31:59 +00:00
1. Create an app on WordPress.com [here ](https://developer.wordpress.com/apps/ ).
2022-09-06 03:51:28 +00:00
2. Recommended settings:
2023-11-10 15:24:48 +00:00
- Name can be anything
- Description can be left blank
- Website URL just put `http://localhost`
- Redirect URLs, by default you should add: `http://localhost:3000/oauth`
- JavaScript Origins put `http://localhost`
- Type - choose "Web"
2022-09-06 03:51:28 +00:00
3. Once your app is created you can go back to the
2023-08-01 01:47:10 +00:00
app list and click "manage app".
2022-09-06 03:51:28 +00:00
4. Take note of the `client secret` and the `client id` .
5. In your `.env` file add the client secret to the `WPCOM_OAUTH_CLIENT_SECRET` variable and the client id to the `WPCOM_OAUTH_CLIENT_ID` variable.
2023-11-10 15:24:48 +00:00
## Generating Just a Contributors List
2022-09-10 21:55:53 +00:00
If you don't have a final release yet you can generate an HTML contributors list that you can copy
paste into a blank post.
2023-11-28 22:50:43 +00:00
To do that simply run `pnpm release-post contributors "<currentVersion>" "<previousVersion>"`
2022-09-10 21:55:53 +00:00
2023-11-10 15:24:48 +00:00
## Advanced
2022-09-06 03:51:28 +00:00
If you can't run anything on your localhost port 3000 you may want to override the redirect uri for oauth.
Steps:
1. Add your preferred redirect URI to the `WPCOM_OAUTH_REDIRECT_URI` variable in `.env` . e.g. `http://localhost:4321/oauth`
2023-01-23 14:31:59 +00:00
2. When creating your app on [WordPress.com ](https://developer.wordpress.com/apps/ ) make sure the redirect URL you set matches the one set in `.env`