-
Notifications
You must be signed in to change notification settings - Fork 68
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
Semantic release updates a file correctly, but doesn't include it in the release #512
Comments
This is issue appears to be unrelated to (OP's config. Pretty printed, enclosed in TS codeblock, and stripped down to the important part) {
plugins: [
["@semantic-release/npm", { npmPublish: true }],
[
"@semantic-release/exec",
{ prepareCmd: "./version.sh ${nextRelease.version}" },
],
[
"@semantic-release/git",
{
assets: [
"CHANGELOG.md",
"package.json",
"package-lock.json",
"src/Constants/Package.ts",
],
},
],
],
} Plugin load order is very important. Your config is telling semantic-release to run Solutionexport function semanticReleaseConfig(params: Params = defaultParams) {
return {
branches: [
"+([0-9])?(.{+([0-9]),x}).x",
params.defaultBranch ?? defaultParams.defaultBranch,
"next",
"next-major",
{ name: "beta", prerelease: true },
{ name: "alpha", prerelease: true },
{ name: "rc", prerelease: true },
],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/exec",
{ prepareCmd: "./version.sh ${nextRelease.version}" },
],
[
"@semantic-release/git",
{
assets: [
"CHANGELOG.md",
"package.json",
"package-lock.json",
"src/Constants/Package.ts",
],
},
],
["@semantic-release/npm", { npmPublish: true }],
"@semantic-release/gitlab",
],
};
} In summary, this config causes the following order of operations: # I added Exec to only the steps it's configured to run in. I also omitted the `success` and `fail` steps which occur before, during, and after many other steps.
Order Of Execution By Step:
# verify conditions necessary to proceed with the release: configuration is correct, authentication token are valid, etc...
verifyConditions:
# Verify the changelogFile and changelogTitle options configuration.
- semantic-release/changelog
# Create a release commit, including configurable file assets.
- semantic-release/exec
# Verify the presence of the NPM_TOKEN environment variable, or an .npmrc file, and verify the authentication method is valid.
- semantic-release/npm
# Verify the presence and the validity of the authentication (set via environment variables).
- semantic-release/gitlab
# add a release channel (e.g. adding an npm dist-tag to a release).
addChannel:
# Add a release to a dist-tag.
- semantic-release/npm
# determine the type of the next release (major, minor or patch). If multiple plugins with a analyzeCommits step are defined, the release type will be the highest one among plugins output.
analyzeCommits:
# Determine the type of release by analyzing commits with conventional-changelog.
- semantic-release/commit-analyzer
# verify the parameters (version, type, dist-tag etc...) of the release that is about to be published.
verifyRelease:
# generate the content of the release note. If multiple plugins with a generateNotes step are defined, the release notes will be the result of the concatenation of each plugin output.
generateNotes:
# Generate release notes for the commits added since the last release with conventional-changelog.
- semantic-release/release-notes-generator
# create or update files such as package.json, CHANGELOG.md, documentation or compiled assets
# and push a commit.
prepare:
# Create or update a changelog file in the local project directory with the changelog content created in the generate notes step.
- semantic-release/changelog
# Create a release commit, including configurable file assets.
- semantic-release/git
# Update the package.json version and create the npm package tarball.
- semantic-release/npm
- - semantic-release/exec
- prepareCmd: "./version.sh ${nextRelease.version}"
publish:
# Publish the npm package to the registry.
- semantic-release/npm
# Publish a GitLab release.
- semantic-release/gitlab
|
Hi, makes sense, but from what you wrote in your last code block, it looks like the preparation step of npm plugin happens before the /exec plugin. Am I missing something? After switching exec and npm parts, the result is still the same - the change I need is committed, but not packaged :( |
All plugins are scoped to the NodeJS process's current working directory unless something explicitly changes it. You can troubleshoot by adding an If it never exists at the expected path, echo the paths of the created file if you can. Otherwise, |
Do you mean that the file might not exist during /npm prepare steps, but exists during git/exec? As stated previously, the /exec part does exactly what I need it to do. After that, the /git plugin successfully commits the file that I changed during the semantic release. Only /npm plugin won't package the newly updated file for some reason :( |
Disregard my previous suggestion. Hmmm...the I have to admit I'm running out of ideas of what the issue could be. I also considered the possibility of a stale cache, but I'm not aware of any caching that could cause this issue. |
Hi,
In our semantic release, we added a simple additional step - running a shell script that updates
src/Constants/Package.ts
file. On inspection we see, that the file is updated and committed. The chore(release) commit includes the correct version of Package.ts file. However the final build of the package only includes the previous state of Package.ts. Meaning, that each subsequent build will have the previous version of Package.ts. So how could the release part ignore the new state of Package.ts, but accept changes on package.json or changelog?Here's the release.config.js:
export function semanticReleaseConfig(params: Params = defaultParams) { return { branches: [ '+([0-9])?(.{+([0-9]),x}).x', params.defaultBranch ?? defaultParams.defaultBranch, 'next', 'next-major', { name: 'beta', prerelease: true }, { name: 'alpha', prerelease: true }, { name: 'rc', prerelease: true }, ], plugins: [ '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/changelog', '@semantic-release/gitlab', [ '@semantic-release/npm', { npmPublish: true }, ], [ '@semantic-release/exec', { prepareCmd: './version.sh ${nextRelease.version}', }, ], [ '@semantic-release/git', { assets: [ 'CHANGELOG.md', 'package.json', 'package-lock.json', 'src/Constants/Package.ts', ], }, ], ], }; }
The text was updated successfully, but these errors were encountered: