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

Add Create Release Job #374

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add Create Release Job #374

wants to merge 3 commits into from

Conversation

ctnkaan
Copy link

@ctnkaan ctnkaan commented Feb 14, 2024

Related to #372

Me and @0xD3n worked on creating this pipeline.

  • Changed History.md to CHANGELOG.md
  • fetch-npm-version: Fetches the version from npm
  • create-github-release: Creates an new release with the title of the version number and hyperlink to CHANGELOG.md

Copy link
Collaborator

@jonkoops jonkoops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of notes:

  1. I think we can put all the work in a single job (under publish)
  2. Getting the version of the package should be possible locally, using npm pkg get version | xargs or cat package.json | jq -r '.version'. This also prevents issues when we're releasing patches for older versions, rather than just the latest tag.

@ctnkaan
Copy link
Author

ctnkaan commented Mar 21, 2024

I've made some improvements but could not quite test it well. I will double check on this tomorow or this weekend if changes are needed.

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Create GitHub Release
run: gh release create ${{ steps.get_version.outputs.version }} --title ${{ steps.get_version.outputs.version }} --notes "Full changelog at https://github.com/JedWatson/classnames/blob/main/CHANGELOG.md"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here there is a reference to a step with the id get_version, but looks like the package version step is missing that id.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right I'll fix it

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Create GitHub Release
run: gh release create ${{ steps.get_version.outputs.version }} --title ${{ steps.get_version.outputs.version }} --notes "Full changelog at https://github.com/JedWatson/classnames/blob/main/CHANGELOG.md"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking that we might want to use the current commit rather than main, so that the relevant notes for that release are always on top. WDYT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good I'll try to add this feature. By the way sorry for the late responses the work has been pretty heavy these few weeks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I also maintain this stuff in my spare time, so I know the pain 😉

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a good idea to use the current commit as if the CHANGELOG did not get updated with that commit it would be empty so I thought linking the main branches CHANGELOG would be a better idea.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a good idea to use the current commit as if the CHANGELOG did not get updated with that commit

That's ok. I always update the changelog before release. In the future I'd like to automate this proccess also.

run: |
VERSION=$(npm pkg get version | xargs)
echo "Package version is $VERSION"
echo "::set-output name=version::$VERSION"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "::set-output name=version::$VERSION"
echo "name=$VERSION" >> $GITHUB_OUTPUT

https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link

@OKEAMAH OKEAMAH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

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

Successfully merging this pull request may close these issues.

5 participants