Skip to content

Commit 94a78a7

Browse files
authored
Merge pull request #992 from ember-cli/release-plan
start using release-plan
2 parents 835419f + f4f2e57 commit 94a78a7

8 files changed

Lines changed: 523 additions & 1852 deletions

File tree

.github/workflows/ci-build.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
branches:
66
- master
77
- main
8-
- release*
9-
- 'v*'
10-
tags:
11-
- '*'
128
pull_request:
139

1410
concurrency:
@@ -81,39 +77,3 @@ jobs:
8177
- name: test
8278
run: pnpm ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
8379
working-directory: ./test-app/
84-
85-
publish:
86-
name: Publish to npm
87-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
88-
runs-on: ubuntu-latest
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v3
92-
93-
- name: Install node
94-
uses: volta-cli/action@v4
95-
with:
96-
node-version: 16.x
97-
registry-url: 'https://registry.npmjs.org'
98-
99-
- uses: actions/cache@v3
100-
id: npm-cache
101-
with:
102-
path: '**/node_modules'
103-
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
104-
restore-keys: |
105-
${{ runner.os }}-npm-
106-
107-
- name: install dependencies
108-
if: steps.npm-cache.outputs.cache-hit != 'true'
109-
run: npm ci
110-
111-
- name: auto-dist-tag
112-
run: npx auto-dist-tag --write
113-
working-directory: './addon/'
114-
115-
- name: publish to npm
116-
run: npm publish
117-
env:
118-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }}
119-
working-directory: './addon/'

.github/workflows/plan-release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Plan Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request_target: # This workflow has permissions on the repo, do NOT run code from PRs in this workflow. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
9+
types:
10+
- labeled
11+
- unlabeled
12+
13+
concurrency:
14+
group: plan-release # only the latest one of these should ever be running
15+
cancel-in-progress: true
16+
17+
jobs:
18+
should-run-release-plan-prepare:
19+
name: Should we run release-plan prepare?
20+
runs-on: ubuntu-latest
21+
outputs:
22+
should-prepare: ${{ steps.should-prepare.outputs.should-prepare }}
23+
steps:
24+
- uses: release-plan/actions/should-prepare-release@v1
25+
with:
26+
ref: 'main'
27+
id: should-prepare
28+
29+
create-prepare-release-pr:
30+
name: Create Prepare Release PR
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 5
33+
needs: should-run-release-plan-prepare
34+
permissions:
35+
contents: write
36+
issues: read
37+
pull-requests: write
38+
if: needs.should-run-release-plan-prepare.outputs.should-prepare == 'true'
39+
steps:
40+
- uses: release-plan/actions/prepare@v1
41+
name: Run release-plan prepare
42+
with:
43+
ref: 'main'
44+
env:
45+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
46+
id: explanation
47+
48+
- uses: peter-evans/create-pull-request@v8
49+
name: Create Prepare Release PR
50+
with:
51+
commit-message: "Prepare Release ${{ steps.explanation.outputs.new-version}} using 'release-plan'"
52+
labels: "internal"
53+
sign-commits: true
54+
branch: release-preview
55+
title: Prepare Release ${{ steps.explanation.outputs.new-version }}
56+
body: |
57+
This PR is a preview of the release that [release-plan](https://github.com/embroider-build/release-plan) has prepared. To release you should just merge this PR 👍
58+
59+
-----------------------------------------
60+
61+
${{ steps.explanation.outputs.text }}

.github/workflows/publish-to-branch.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# For every push to the primary branch with .release-plan.json modified,
2+
# runs release-plan.
3+
4+
name: Publish Stable
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
paths:
13+
- '.release-plan.json'
14+
15+
concurrency:
16+
group: publish-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
publish:
21+
name: "NPM Publish"
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
id-token: write
26+
attestations: write
27+
28+
steps:
29+
- uses: actions/checkout@v6
30+
- uses: pnpm/action-setup@v4
31+
- uses: actions/setup-node@v6
32+
with:
33+
node-version: 22
34+
registry-url: 'https://registry.npmjs.org'
35+
cache: pnpm
36+
- run: npm install -g npm@latest # ensure that the globally installed npm is new enough to support OIDC
37+
- run: pnpm install --frozen-lockfile
38+
- name: Publish to NPM
39+
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
40+
env:
41+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Changelog
2+
13

24

35

RELEASE.md

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,27 @@
1-
# Release
2-
3-
Releases are mostly automated using
4-
[release-it](https://github.com/release-it/release-it/) and
5-
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
1+
# Release Process
62

3+
Releases in this repo are mostly automated using [release-plan](https://github.com/embroider-build/release-plan/). Once you label all your PRs correctly (see below) you will have an automatically generated PR that updates your CHANGELOG.md file and a `.release-plan.json` that is used to prepare the release once the PR is merged.
74

85
## Preparation
96

10-
Since the majority of the actual release process is automated, the primary
11-
remaining task prior to releasing is confirming that all pull requests that
12-
have been merged since the last release have been labeled with the appropriate
13-
`lerna-changelog` labels and the titles have been updated to ensure they
14-
represent something that would make sense to our users. Some great information
15-
on why this is important can be found at
16-
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
7+
Since the majority of the actual release process is automated, the remaining tasks before releasing are:
8+
9+
- correctly labeling **all** pull requests that have been merged since the last release
10+
- updating pull request titles so they make sense to our users
11+
12+
Some great information on why this is important can be found at [keepachangelog.com](https://keepachangelog.com/en/1.1.0/), but the overall
1713
guiding principle here is that changelogs are for humans, not machines.
1814

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

21-
* breaking - Used when the PR is considered a breaking change.
22-
* enhancement - Used when the PR adds a new feature or enhancement.
23-
* bug - Used when the PR fixes a bug included in a previous release.
24-
* documentation - Used when the PR adds or updates documentation.
25-
* internal - Used for internal changes that still require a mention in the
26-
changelog/release notes.
17+
- breaking - Used when the PR is considered a breaking change.
18+
- enhancement - Used when the PR adds a new feature or enhancement.
19+
- bug - Used when the PR fixes a bug included in a previous release.
20+
- documentation - Used when the PR adds or updates documentation.
21+
- internal - Internal changes or things that don't fit in any other category.
2722

23+
**Note:** `release-plan` requires that **all** PRs are labeled. If a PR doesn't fit in a category it's fine to label it as `internal`
2824

2925
## Release
3026

31-
Once the prep work is completed, the actual release is straight forward:
32-
33-
* First ensure that you have `release-it` installed globally, generally done by
34-
using one of the following commands:
35-
36-
```
37-
# using https://volta.sh
38-
volta install release-it
39-
40-
# using Yarn
41-
yarn global add release-it
42-
43-
# using npm
44-
npm install --global release-it
45-
```
46-
47-
* Second, ensure that you have installed your projects dependencies:
48-
49-
```
50-
yarn install
51-
```
52-
53-
* And last (but not least 😁) do your release. It requires a
54-
[GitHub personal access token](https://github.com/settings/tokens) as
55-
`$GITHUB_AUTH` environment variable. Only "repo" access is needed; no "admin"
56-
or other scopes are required.
57-
58-
```
59-
export GITHUB_AUTH="f941e0..."
60-
release-it
61-
```
62-
63-
[release-it](https://github.com/release-it/release-it/) manages the actual
64-
release process. It will prompt you to to choose the version number after which
65-
you will have the chance to hand tweak the changelog to be used (for the
66-
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
67-
pushing the tag and commits, etc.
27+
Once the prep work is completed, the actual release is straight forward: you just need to merge the open [Plan Release](https://github.com/ember-cli/ember-resolver/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version": "13.1.1",
23
"private": true,
34
"repository": {
45
"type": "git",
@@ -15,8 +16,6 @@
1516
"devDependencies": {
1617
"@babel/eslint-parser": "^7.21.3",
1718
"@babel/plugin-proposal-decorators": "^7.21.0",
18-
"@release-it-plugins/lerna-changelog": "5.0.0",
19-
"@release-it-plugins/workspaces": "^3.2.0",
2019
"ember-template-lint": "^5.7.2",
2120
"eslint": "^8.46.0",
2221
"eslint-config-prettier": "^8.9.0",
@@ -26,30 +25,7 @@
2625
"eslint-plugin-qunit": "^7.3.4",
2726
"npm-run-all": "^4.1.5",
2827
"prettier": "^2.8.4",
29-
"release-it": "^15.6.0"
28+
"release-plan": "^0.17.4"
3029
},
31-
"release-it": {
32-
"hooks": {
33-
"before:init": "cp README.md LICENSE.md addon/"
34-
},
35-
"plugins": {
36-
"@release-it-plugins/workspaces": {
37-
"publish": false
38-
},
39-
"@release-it-plugins/lerna-changelog": {
40-
"infile": "CHANGELOG.md",
41-
"launchEditor": true
42-
}
43-
},
44-
"git": {
45-
"tagName": "v${version}"
46-
},
47-
"npm": false,
48-
"github": {
49-
"release": true,
50-
"tokenRef": "GITHUB_AUTH"
51-
}
52-
},
53-
"packageManager": "pnpm@10.29.3",
54-
"version": "13.1.1"
30+
"packageManager": "pnpm@10.29.3"
5531
}

0 commit comments

Comments
 (0)