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

chore: add release workflow #805

Closed
wants to merge 5 commits into from
Closed

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jul 29, 2021

Summary

This PR adds the release workflow using Ship.js.

fixes #801

Release Workflow

  1. Prepare: It will prepare a release pull-request which includes version bumping and changelog updates.

  2. Review: Maintainers review the PR, probably updates some changelogs, approve and merge it.

  3. Trigger: CI (in this case, GitHub Actions) is triggered, and it builds, and releases the package to NPM. It also creates a git tag and GitHub releases.

More about "Prepare" step

There are three ways to prepare release pull-request.

  1. Because of .github/workflows/shipjs-schedule-prepare.yml, it will automatically prepare the pull-request every week.
  2. You run also yarn run prepare locally with the environment variable GITHUB_TOKEN.
  3. Because of .github/workflows/shipjs-manual-prepare.yml, if maintainers of this repo adds a comment @shipjs prepare to any comment, it will prepare a release pull-request. (← If you don't want this behavior, you can remove the workflow file.)

Remaining Setup

This repo needs to have two environment variables for GitHub Actions:

  1. GITHUB_TOKEN: https://github.com/settings/tokens/new
  2. NPM_AUTH_TOKEN: If your NPM account has 2FA enabled, you need to create "Automation" token.

CleanShot 2021-07-29 at 09 50 37@2x

name: Ship js Schedule Prepare
on:
schedule:
- cron: '0 9 * * 2'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can change the cron expression if there's any preferred time/date.
Currently it's every Tuesday 02:00 UTC.

Comment on lines +2 to +3
publishCommand: ({ defaultCommand, tag }) =>
`${defaultCommand} --access public --tag ${tag}`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will run a command like npm publish --access public --tag latest.

Comment on lines +4 to +10
shouldPrepare: ({ releaseType, commitNumbersPerType }) => {
const { fix = 0 } = commitNumbersPerType
if (releaseType === 'patch' && fix === 0) {
return false
}
return true
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it's going to be a patch release, but doesn't include "fix" commits, then it will skip the release. Think about having only "chore" commits. You probably don't want to release it.

This is especially useful when you have scheduled releases.

@eunjae-lee eunjae-lee marked this pull request as ready for review July 29, 2021 07:58
@lmiller1990
Copy link
Member

Hi @eunjae-lee, sorry about the delay on this - I will go over it this week!

@eunjae-lee
Copy link
Contributor Author

Hello @lmiller1990, how are you doing?
Pinging you to see if you need any help or clarification.
I understand you are busy and if you postpone or close this PR.
Just letting you know that I can help :)

@afontcu
Copy link
Member

afontcu commented Sep 17, 2021

Relevant: github/roadmap#248

we might want to wait until GitHub ships its own release management tool :)

@lmiller1990
Copy link
Member

Automated releases are certainly a good idea, I was thinking we may want to get 2.0.0 out before we merge this.

Thanks for the work @eunjae-lee, sorry I left this hanging for so long.

@eunjae-lee
Copy link
Contributor Author

No worries @lmiller1990 :)
Feel free to postpone or close this PR as the core contributors decide.
In case you proceed, I'm here to help!

@lmiller1990
Copy link
Member

We finally moved to 2.0.0. I'll take a look at this soon, so we can have automatic releases.

@lmiller1990
Copy link
Member

If we do end up automating this, I think we should go with semantic release to be in line with other Vue projects. I'm going to close this one for now, but I appreciate the effort.

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.

release workflow
3 participants