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

[BUG] generate failed when make a patch version update #59

Closed
yi-Xu-0100 opened this issue Mar 2, 2021 · 6 comments · Fixed by #63 · May be fixed by yi-Xu-0100/vscode-conventional-commits#6
Closed

[BUG] generate failed when make a patch version update #59

yi-Xu-0100 opened this issue Mar 2, 2021 · 6 comments · Fixed by #63 · May be fixed by yi-Xu-0100/vscode-conventional-commits#6
Assignees
Labels
enhancement New feature or request

Comments

@yi-Xu-0100
Copy link
Collaborator

The changelog-reader-action can not read the third level heading, in which case the workflows failed when make a patch version update.

@yi-Xu-0100 yi-Xu-0100 added the enhancement New feature or request label Mar 2, 2021
@yi-Xu-0100 yi-Xu-0100 self-assigned this Mar 2, 2021
@yi-Xu-0100
Copy link
Collaborator Author

This changelog-reader-action only works if your CHANGELOG.md file follows the Keep a Changelog standard for now.

So the change log under the conventional-changelog can't work well here.

There are two ways to fix this issue:

1.1. change the changelog format to fit the changelog-reader-action.
1.2. change the workflows to find a new ways to publish release.

There also some new ways to ignore this issue.

2.1. We can use a personal access token to publish this extension and give it up to make the release.
2.2. Only use the link description(Changelogs: https://...) to fill into the release body and detect the latest version from the package.json, when the workflows trigger on the file changed of CHANGELOG.md.

I will achieve the 2.2 to fix the issue temporarily.

@vivaxy I think more discussion needed here. 😀

yi-Xu-0100 added a commit that referenced this issue Mar 2, 2021
Only use the link description(`Changelogs: https://...`) to fill into the release body.
Detect the latest version from the `package.json`.
The workflows trigger on the file changed of `CHANGELOG.md`.

Ref: #59
@vivaxy
Copy link
Owner

vivaxy commented Mar 3, 2021

@yi-Xu-0100 What you did with GitHub Actions is awesome!

I'm not familiar with GitHub Actions. But still, I've some questions:

  1. Is it possible to reuse npm scripts with GitHub Actions and local publishing? I'd like to think GitHub Actions as a much advanced way of publishing. When it fails, it's better to fallback to local publishing. So it's better to have those two publishing ways in the same steps with the same npm scripts.
  2. Is https://github.com/TriPSs/conventional-changelog-action applicable in our scenario? So we can tigger GitHub Actions manually with the following steps:
    1. Set up job
    2. Checkout code
    3. Bump version and write change log with https://github.com/TriPSs/conventional-changelog-action
    4. Generate Package
    5. Create release
    6. Upload release asset

@yi-Xu-0100
Copy link
Collaborator Author

yi-Xu-0100 commented Mar 3, 2021

@vivaxy Thanks for your suggestion here, I use the script for some reason.

  1. The scripts I used in actions that npm run package is used to make "offline" package for extension and upload to release asset.
  2. I can not use the npm run release to publish a new version because I did not have the personal access token for this extension. I upload the .vsix package to market to update the extension, so I need the npm run package to generate the package.
  3. Because I can not use the npm run release, so I add a script version to bump the version for the extension, I see the comment in ci(actions): 👷 add CI to build package and release #57, If this name of the script is not suitable, I will adjust it.
  4. I think trigger manually can help to make the release, but for me, I also need to package locally to upload the package to market. Maybe we can use the https://github.com/HaaLeo/publish-vscode-extension to help the publishing, but the action needs the PAT to use it.

So the action workflows can trigger manually and run with the following steps:

  1. Set up job
  2. Checkout code
  3. Bump version and write change log with https://github.com/TriPSs/conventional-changelog-action
  4. Use the https://github.com/HaaLeo/publish-vscode-extension to publish extension and output the .vsix path
  5. Create release
  6. Upload release asset

For the possible error in action.

  1. If step 3 occurs an error, the release will not be created, we may need to publish locally with scripts(vsce publish for you, and the vsce package for me) which may need to be separated into other scripts.
  2. for the existing step 2, the standard-version may be deleted.

For the CHANGELOG.md I also find the content changed with the prettier, maybe we should add it to the .prettierignore.

For the version script, I did not find the named script in pre--post-scripts, Could you point it out for me? Thanks a lot! 😀

@yi-Xu-0100
Copy link
Collaborator Author

I find the official tutorials about GitHub action, maybe we can use the script according to it.

But we also need the ${{ secrets.VSCE_PAT }}, You can set into the repository secrets in advance. 😀

@vivaxy
Copy link
Owner

vivaxy commented Mar 6, 2021

Hi, @yi-Xu-0100. Thank you for your detailed reply.

I think, in conclusion, the VSCE_PAT is the key to this problem. I've added it to the repo setting. We can try later to see wether it works.

For the version script, I've tested it. The version command in npm scripts runs with npm version command. I'm not sure why this behavior is not in the document.

image

yi-Xu-0100 added a commit that referenced this issue Mar 10, 2021
Prettier changelog content to reader format.

ref: #59
@yi-Xu-0100
Copy link
Collaborator Author

yi-Xu-0100 commented Mar 10, 2021

@vivaxy I try to figure out whether the format should be, and found this issue(conventional-changelog/standard-version#317). So I use the standard-version for create commit, and lint by the personal options. 😀

In conclusion, I changed the workflows, and it will run with the follow steps by trigger manually:

  1. Set up job and checkout code for all history with tags.
  2. Bump version of package.json and write change log with standard-version.
  3. Pretty the format of CHANGELOG.md and push the commit.
  4. Follow the official tutorials to publish extension.
  5. Build the .vsix.
  6. Get the release note from the formated CHANGELOG.md by using mindsers/changelog-reader-action.
  7. Create release.
  8. Upload release asset.

By the way, thanks for the suggestion about the name of the script version. I learn more from this. 😊

@yi-Xu-0100 yi-Xu-0100 reopened this Mar 11, 2021
yi-Xu-0100 added a commit that referenced this issue Mar 11, 2021
The `release` workflow will run with the follow steps by trigger manually:
1. Set up job and checkout code for all history with tags.
2. Bump version of `package.json` and write change log with `standard-version`.
3. Pretty the format of `CHANGELOG.md`, push the commit, and add a tag.
4. Follow the [official tutorials](https://code.visualstudio.com/api/working-with-extensions/continuous-integration#github-actions-automated-publishing) to publish extension.
5. Build the `.vsix`.
6. Get the release note from the formated `CHANGELOG.md` by using `mindsers/changelog-reader-action`.
7. Create release.
8. Upload release asset.

Other changes:
1. add `CHANGELOG.md` into `.prettierignore`.
2. add the script `deploy` for publish.
3. delete the script `version`.
4. delete the script `release`.
5. use the cmd of `sed 's/^### \[/## [/' -i CHANGELOG.md` to change the changelog content, because it will make content to fit the markdown rules.
6. use the cmd of `yarn prettier --write CHANGELOG.md --prose-wrap never --ignore-path ./gitignore
` to pretty the format of `CHANGELOG.md`, and it will make content to fill correcttly with the release body.

Close #59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment