Skip to content

Commit

Permalink
Add release setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kategengler committed Apr 5, 2023
1 parent 0c8493e commit 30591be
Show file tree
Hide file tree
Showing 5 changed files with 2,305 additions and 56 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- main
- master
tags:
- '*'
pull_request: {}

concurrency:
Expand All @@ -22,7 +24,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand All @@ -40,9 +42,34 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x
cache: yarn
- name: Install Dependencies
run: yarn install --no-lockfile
- name: Run Tests
run: yarn test:node

publish:
name: Publish to npm
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'

- name: install dependencies
run: yarn install --frozen-lockfile --ignore-engines

- name: auto-dist-tag
run: npx auto-dist-tag --write

- name: publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
62 changes: 62 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Release Process

Releases are mostly automated using
[release-it](https://github.com/release-it/release-it/) and
[lerna-changelog](https://github.com/lerna/lerna-changelog/).

## Preparation

Since the majority of the actual release process is automated, the primary
remaining task prior to releasing is confirming that all pull requests that
have been merged since the last release have been labeled with the appropriate
`lerna-changelog` labels and the titles have been updated to ensure they
represent something that would make sense to our users. Some great information
on why this is important can be found at
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
guiding principle here is that changelogs are for humans, not machines.

When reviewing merged PR's the labels to be used are:

* breaking - Used when the PR is considered a breaking change.
* enhancement - Used when the PR adds a new feature or enhancement.
* bug - Used when the PR fixes a bug included in a previous release.
* documentation - Used when the PR adds or updates documentation.
* internal - Used for internal changes that still require a mention in the
changelog/release notes.

## Release

Once the prep work is completed, the actual release is straight forward:

* First, ensure that you have installed your projects dependencies:

```sh
yarn install
```

* Second, ensure that you have obtained a
[GitHub personal access token][generate-token] with the `repo` scope (no
other permissions are needed). Make sure the token is available as the
`GITHUB_AUTH` environment variable.

For instance:

```bash
export GITHUB_AUTH=abc123def456
```

[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable

* And last (but not least 😁) do your release.

```sh
npx release-it
```

[release-it](https://github.com/release-it/release-it/) manages the actual
release process. It will prompt you to to choose the version number after which
you will have the chance to hand tweak the changelog to be used (for the
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
pushing the tag and commits, etc.

CI then will publish the tagged release to npm.
31 changes: 27 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
"bugs": {
"url": "https://github.com/ember-cli/ember-cli-clean-css/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ember-cli/ember-cli-clean-css.git"
},
"license": "MIT",
"author": "Robert Jackson <me@rwjblue.com>",
"main": "index.js",
"directories": {
"test": "tests"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ember-cli/ember-cli-clean-css.git"
},
"scripts": {
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
Expand All @@ -38,6 +38,7 @@
"@ember/string": "^3.0.1",
"@ember/test-helpers": "^2.8.1",
"@embroider/test-setup": "^2.1.1",
"@release-it-plugins/lerna-changelog": "^5.0.0",
"babel-eslint": "^10.1.0",
"concurrently": "^8.0.1",
"ember-auto-import": "^2.6.1",
Expand All @@ -64,15 +65,37 @@
"prettier": "^2.8.7",
"qunit": "^2.19.2",
"qunit-dom": "^2.0.0",
"release-it": "^15.5.0",
"webpack": "^5.77.0"
},
"engines": {
"node": "14.* || 16.* || >= 18"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"configPath": "tests/dummy/config"
},
"release-it": {
"plugins": {
"@release-it-plugins/lerna-changelog": {
"infile": "CHANGELOG.md",
"launchEditor": true
}
},
"git": {
"tagName": "v${version}"
},
"github": {
"release": true,
"tokenRef": "GITHUB_AUTH"
},
"npm": {
"publish": false
}
}
}
Loading

0 comments on commit 30591be

Please sign in to comment.