-
Notifications
You must be signed in to change notification settings - Fork 827
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
Setting up a changesets based release workflow #681
Changes from 24 commits
d2c0342
1c7ba01
8719911
d67b0b9
54ce41e
d0a1c48
533e78e
fae0616
16d70b5
9056681
8d7aa84
d2fdfc4
aba86d0
ca299ba
02996b7
24abd8b
c25611e
3fa1b5e
dec7de1
1c4caf4
7c7a21d
75865ac
93764f6
08cb24b
ec692a3
8facd8b
81c358d
c394d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/config@1.6.1/schema.json", | ||
"changelog": ["@changesets/changelog-github", {"repo": "primer/octicons"}], | ||
"commit": false, | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'next_major' | ||
jobs: | ||
release: | ||
name: Final | ||
if: ${{ github.repository == 'primer/octicons' }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Setup Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
yarn | ||
bundle install | ||
|
||
- name: Create release pull request or publish to npm | ||
id: changesets | ||
uses: changesets/action@master | ||
with: | ||
title: Release Tracking | ||
version: yarn changeset:version | ||
# This is a hack to make the changeset action think we npm published, so that it creates the github release | ||
publish: echo "New tag:" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GPR_AUTH_TOKEN_SHARED }} | ||
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
.env | ||
node_modules | ||
vendor | ||
Gemfile.lock | ||
|
||
# Ignore build/export artifacts | ||
lib/**/build/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,45 +95,12 @@ If everything looks good, a maintainer will approve and merge the pull request w | |
|
||
Once submitted changes have been agreed upon, these instructions will guide maintainers through releasing changes. | ||
|
||
### 1. Create a release branch in the [primer/octicons](https://github.com/primer/octicons) repository. | ||
Releases are managed by 🦋 [Changesets](https://github.com/atlassian/changesets#documentation) which is a great tool for managing major/minor/patch bumps and changelogs. | ||
|
||
```shell | ||
git checkout -b release-x.y.z | ||
``` | ||
|
||
In the context of Octicons, the version number is updated as follows: | ||
|
||
- Breaking changes to the library or workflow, renaming or removing an icon would all be considered a **major update**. | ||
- Adding a new icon would be considered a **minor update**. | ||
- Fixing an icon would be considered a **patch**. | ||
|
||
Reach out in the #design-systems Slack channel if you're unsure. | ||
|
||
### 2. Update the [CHANGELOG](https://github.com/primer/octicons/blob/main/CHANGELOG.md) describing the changes in this release. | ||
|
||
When adding changes, be sure to provide a link to any of the relevant PRs merged into the release. | ||
|
||
### 3. Update the version in code base | ||
|
||
Find and replace the version number of the current release with the version number of the new release. Exclude anything that does relate directly to the Octicons version. Examples of excluded items include `yargs-parser` and `testing-library_react`. | ||
|
||
### 4. Create a release PR | ||
|
||
When creating the release PR, include the changes written in the CHANGELOG in the description. We advise changing any bulleted item into a checkbox item. After each update is merged into the release PR, check each item as complete. | ||
|
||
### 5. Merge | ||
When all of the checks have passed and the release PR has been approved, merge the new release to the main branch. | ||
|
||
### 6. Draft new release | ||
- On the **Code** tab, click **Releases** in the repo sidebar. | ||
- Click **Draft a new release**. | ||
- Tag the release with the new version number (e.g. `v10.1.0`). | ||
- Title the release with the new version number and paste in the changes that were added to the CHANGELOG. | ||
- Click **Publish release**. | ||
|
||
**Example:** | ||
We have the [changeset-bot comment on new pull requests](https://github.com/changesets/bot#readme) asking contributors or maintainers to add a changeset file, which will become the markdown supported changelog entry for the change. | ||
|
||
![image](https://user-images.githubusercontent.com/10384315/91103190-c6171e80-e61f-11ea-8396-7138996cff30.png) | ||
When a pull request is approved merge it into the `main` branch. The changeset action will then create a Release pull request that includes this new pull request. | ||
|
||
Once maintainers have agreed and are satisifed with the release. Merge the Release pull request. Changesets will then publish a new GitHub release to the repository with the changelog and new version number. A second action will be triggered by this release and publish the new versions to npm and rubygems. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a link to this document in here somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice I didn't realize we had these docs 👍🏻 |
||
|
||
🎉 Congratulations! The new release has been published. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source "https://rubygems.org" | ||
|
||
group :development, :test do | ||
gem "minitest" | ||
gem "rake" | ||
gem "rubocop", "0.59" | ||
gem "rubocop-github", "0.12.0" | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not too familiar with how Gemfiles work. What does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit like package.json, I needed to pull these dev dependencies up to the root so I could run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
{ | ||
"private": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather keep this private, but changesets will skip if they find private true here, so I'm trying to avoid publishing main package.json file by adding + "publishConfig": {
+ "registry": "http://localhost:4873"
+ }, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does that port number come from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wanting to point to anything other than npm and co-pilot suggested this 😆 The point is to fail it out so people don't I'll accept whatever you think here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, should we just say like Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"name": "@primer/octicons", | ||
"version": "16.1.0", | ||
"publishConfig": { | ||
"registry": "http://localhost:4873" | ||
}, | ||
"scripts": { | ||
"version": "script/version", | ||
"changeset:version": "changeset version && script/version", | ||
"test": "ava -v tests/*.js", | ||
"lint": "eslint tests", | ||
"build": "script/build.js --input icons/**/*.svg --output lib/build/data.json", | ||
"start": "cd docs && npm run develop", | ||
"svgo": "svgo icons --config .svgo.yml" | ||
}, | ||
"dependencies": { | ||
"@changesets/changelog-github": "0.4.1", | ||
"@changesets/cli": "2.17.0", | ||
"@github/prettier-config": "0.0.4", | ||
"ava": "2.1.0", | ||
"braces": "2.3.1", | ||
"cheerio": "1.0.0-rc.3", | ||
"eslint": "7.24.0", | ||
"eslint-plugin-github": "4.1.3", | ||
"eslint": "8.0.1", | ||
"eslint-plugin-github": "4.3.2", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"execa": "4.0.0", | ||
"fs-extra": "7.0.1", | ||
"globby": "11.0.0", | ||
|
@@ -39,7 +46,8 @@ | |
"requireConfigFile": false | ||
}, | ||
"rules": { | ||
"github/no-then": 0 | ||
"github/no-then": 0, | ||
"eslint-comments/no-use": 0 | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this workflow to "publish"?