Skip to content

Commit

Permalink
Merge pull request #261 from ember-cli/kg-add-ci-releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
kategengler committed Aug 16, 2023
2 parents 3f97af6 + 47fd57a commit 0e4ce70
Show file tree
Hide file tree
Showing 9 changed files with 2,356 additions and 45 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- uses: volta-cli/action@v4
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Lint Addon
Expand All @@ -34,13 +34,13 @@ jobs:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox]
node: ['14', '16', '18']
node: ['16', '18']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
Expand All @@ -61,10 +61,10 @@ jobs:
browser: [chrome, firefox]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- uses: volta-cli/action@v4
- name: Install Dependencies
run: yarn install --no-lockfile --non-interactive
- name: Test
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
allow-failure: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- uses: volta-cli/action@v4
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Test
Expand All @@ -115,12 +115,12 @@ jobs:
timeout-minutes: 20
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- uses: volta-cli/action@v4
with:
node-version: 14
node-version: 16.x
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Test
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/publish-to-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to branch

on:
push:
branches:
- main
- master

jobs:
push-dist:
name: Push dist to branch to see built contents
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v4
with:
node-version: 16.x

- name: Install Dependencies
run: yarn install --frozen-lockfile

- uses: kategengler/put-built-npm-package-contents-on-branch@v1.0.0
with:
branch: dist
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./addon/
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
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

- uses: volta-cli/action@v4
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: auto-dist-tag
run: npx auto-dist-tag --write
working-directory: './addon/'

- name: publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
working-directory: './addon/'
64 changes: 64 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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.

Once the tag has been pushed, the GitHub workflow `publish.yml` will be triggered
to publish the package(s) to npm. This workflow does not wait for tests to pass, so
be sure to only run `release-it` on a passing build.
2 changes: 1 addition & 1 deletion addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"rollup": "^2.67.0"
},
"engines": {
"node": "14.* || 16.* || >= 18"
"node": "16.* || >= 18"
},
"ember-addon": {
"demoURL": "https://ember-cli.github.io/ember-page-title",
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"webpack": "^5.0.0"
},
"engines": {
"node": "14.* || 16.* || >= 18"
"node": "16.* || >= 18"
},
"ember": {
"edition": "octane"
Expand Down
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"private": true,
"repository": {
"type": "git",
"url": "git@github.com:ember-cli/ember-page-title.git"
},
"workspaces": [
"addon",
"docs",
Expand All @@ -8,8 +12,35 @@
"scripts": {
"prepare": "cd addon && yarn build"
},
"devDependencies": {
"@release-it-plugins/lerna-changelog": "^6.0.0",
"@release-it-plugins/workspaces": "^4.0.0",
"release-it": "^16.1.5"
},
"volta": {
"node": "16.20.2",
"yarn": "1.22.17"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"release-it": {
"plugins": {
"@release-it-plugins/workspaces": {
"publish": false
},
"@release-it-plugins/lerna-changelog": {
"infile": "CHANGELOG.md",
"launchEditor": true
}
},
"git": {
"tagName": "v${version}"
},
"npm": false,
"github": {
"release": true,
"tokenRef": "GITHUB_AUTH"
}
}
}
2 changes: 1 addition & 1 deletion test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"webpack": "^5.0.0"
},
"engines": {
"node": "14.* || 16.* || >= 18"
"node": "16.* || >= 18"
},
"ember": {
"edition": "octane"
Expand Down
Loading

0 comments on commit 0e4ce70

Please sign in to comment.