|
| 1 | +# Troubleshooting |
| 2 | + |
| 3 | +## Debugging with the CLI |
| 4 | + |
| 5 | +The easiest way to debug your `release-please` configuration is to use the bundled |
| 6 | +CLI. |
| 7 | + |
| 8 | +To use the CLI, you will need to use a GitHub |
| 9 | +[personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token): |
| 10 | + |
| 11 | +```bash |
| 12 | +# install the release-please binary |
| 13 | +npm install -g release-please |
| 14 | + |
| 15 | +export GITHUB_TOKEN="my-access-token" |
| 16 | +release-please release-pr \ |
| 17 | + --token=${GITHUB_TOKEN} \ |
| 18 | + --repo-url=my-owner/my-repo \ |
| 19 | + --debug \ |
| 20 | + --dry-run |
| 21 | +``` |
| 22 | + |
| 23 | +The CLI provides a `--dry-run` mode which will tell you what it would do without |
| 24 | +actually doing it (i.e. without opening a pull request or tagging releases). |
| 25 | +Additionally, we provide log level options `--debug` or `--trace` which will |
| 26 | +show more in-depth logging and should help give you insight into what `release-please` |
| 27 | +is trying to do. |
| 28 | + |
| 29 | +### Testing in another branch |
| 30 | + |
| 31 | +When testing out a new change to the `release-please-config.json`, make the change |
| 32 | +in a new branch on the actual repository (not a fork). `release-please` relies on |
| 33 | +pull requests, releases, and tags which are not copied when you fork the original |
| 34 | +repository. |
| 35 | + |
| 36 | +After pushing your change to the new branch, you can target the new branch using |
| 37 | +the `--target-branch` option. |
| 38 | + |
| 39 | +```bash |
| 40 | +export GITHUB_TOKEN="my-access-token" |
| 41 | +release-please release-pr \ |
| 42 | + --token=${GITHUB_TOKEN} \ |
| 43 | + --repo-url=my-owner/my-repo \ |
| 44 | + --target-branch=my-test-branch \ |
| 45 | + --debug \ |
| 46 | + --dry-run |
| 47 | +``` |
| 48 | + |
| 49 | +## Frequently Asked Questions |
| 50 | + |
| 51 | +### What is a component? |
| 52 | + |
| 53 | +A component is an individually releasable artifact or group of |
| 54 | +artifacts within a repository. |
| 55 | + |
| 56 | +The most common configuration is for a single repository to |
| 57 | +release a single package. In this case, the releases and tags |
| 58 | +with have simple versions like `v1.2.3`. In this case, you |
| 59 | +will not need to configure a `component` in the configuration. |
| 60 | + |
| 61 | +In the case of a monorepo, you may have separate, independently |
| 62 | +releaseable artifacts. In this case, the releases will use a |
| 63 | +`component` prefix for the release and tag like |
| 64 | +`my-component-v1.2.3`. This allows you to have separate releases |
| 65 | +and tags for each component for version `1.2.3`. |
| 66 | + |
| 67 | +You will need to configure a `component` name in the manifest |
| 68 | +config for each of your independent modules (separated by |
| 69 | +code path): |
| 70 | + |
| 71 | +```json |
| 72 | +{ |
| 73 | + "packages": { |
| 74 | + "path/to/pkg-a": { |
| 75 | + "component": "pkg-a" |
| 76 | + }, |
| 77 | + "path/to/pkg-b": { |
| 78 | + "component": "pkg-b" |
| 79 | + } |
| 80 | + } |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +### How does release-please determine the previous release? |
| 85 | + |
| 86 | +#### If you are using a manifest config (highly advised) |
| 87 | + |
| 88 | +`release-please` reads the latest released version from the |
| 89 | +manifest file (`.release-please-manifest.json`). The file is a map |
| 90 | +of component path to the latest release version. In a single |
| 91 | +component setup, the path should be `.`. `release-please` tries to |
| 92 | +identify the commit SHA of that release version by looking at |
| 93 | +recent releases and falling back to looking at the expected tag name. |
| 94 | + |
| 95 | +#### If you are NOT using a manifest config |
| 96 | + |
| 97 | +`release-please` uses a few methods to try determine the latest |
| 98 | +release. Note that this process can be fragile and will require |
| 99 | +more API calls (which is one reason a manifest config is preferred). |
| 100 | + |
| 101 | +1. Iterate through the last 250 commits on the target branch and |
| 102 | + look for an associated release pull request. If found, extract |
| 103 | + the latest release version from that pull request. |
| 104 | +2. Iterate through the latest releases and compare against commit |
| 105 | + SHAs seen in the last 250 commits on the target branch. This |
| 106 | + is to ensure that the release happened on this target branch. |
| 107 | +3. Iterate through the latest tags and compare against commit |
| 108 | + SHAs seen in the last 250 commits on the branch. This is to |
| 109 | + ensure that the tag happened on this target branch. |
0 commit comments