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

Semantic Release Not Handling Package.json Or Files One Level Up Correctly #485

Open
jxe142 opened this issue Oct 18, 2023 · 1 comment
Open

Comments

@jxe142
Copy link

jxe142 commented Oct 18, 2023

Current behavior

When using the following configuration, the @semantic-release/git plugin appears to push the changelog and any files located in the same or subdirectory of the releasing library to the target branch. However, it does not push the package.json files or any other files that are one level up (../) from the released library.

const commitUpdatedAssets = [
  '@semantic-release/git',
  {
   // Notice we use a regex and relative path and both fail but CHANGELOG.md works
    assets: ['../**/*/package.json', `${disRoot}/package.json`, `../beam/package.json`  'CHANGELOG.md'],
    message:
      'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
  },
];

const plugIns = [
  commitAnalyzer,
  releaseNotesGenerator,
  updatePackagesThatDepOnMeVersion,
  changelog,
  npm,
  github,
  commitUpdatedAssets,
];

Expected behavior

The @semantic-release/git plugin should respect other package.json files or files that are not in the released library and are one level up (../). These files should be pushed to the repository along with the files that are local to the library (./).

@bvanderdrift
Copy link

For anyone running into this issue as well, where any files from a parent directory won't be added:

We used @semantic-release/exec to manually add the files before running @semantic-release/git:

    [
      "@semantic-release/exec",
      {
        prepareCmd:
          "git add ../foo/bar.txt ../fooz/baz.txt",
      },
    ],
    [
      "@semantic-release/git",
      {
        // Something needs to be in there, otherwise the git plugin won't create a commit because it thinks nothing was added
        assets: ["package.json"], 
      },
    ],

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

No branches or pull requests

2 participants