Skip to content

Commit 9ac455b

Browse files
Merge pull request #404 from adopted-ember-addons/release-plan
Setup release-plan
2 parents 8cfd3a7 + 8cb7ed2 commit 9ac455b

6 files changed

Lines changed: 1187 additions & 24 deletions

File tree

.github/workflows/plan-release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release Plan Review
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
pull_request:
8+
types:
9+
- labeled
10+
11+
concurrency:
12+
group: plan-release # only the latest one of these should ever be running
13+
cancel-in-progress: true
14+
15+
jobs:
16+
check-plan:
17+
name: "Check Release Plan"
18+
runs-on: ubuntu-latest
19+
outputs:
20+
command: ${{ steps.check-release.outputs.command }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
ref: 'master'
27+
# This will only cause the `check-plan` job to have a "command" of `release`
28+
# when the .release-plan.json file was changed on the last commit.
29+
- id: check-release
30+
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
31+
32+
prepare_release_notes:
33+
name: Prepare Release Notes
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 5
36+
needs: check-plan
37+
permissions:
38+
contents: write
39+
pull-requests: write
40+
outputs:
41+
explanation: ${{ steps.explanation.outputs.text }}
42+
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
43+
# only run on labeled event if the PR has already been merged
44+
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
# We need to download lots of history so that
49+
# github-changelog can discover what's changed since the last release
50+
with:
51+
fetch-depth: 0
52+
ref: 'master'
53+
- uses: wyvox/action-setup-pnpm@v3
54+
55+
- name: "Generate Explanation and Prep Changelogs"
56+
id: explanation
57+
run: |
58+
set +e
59+
60+
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
61+
62+
63+
if [ $? -ne 0 ]; then
64+
echo 'text<<EOF' >> $GITHUB_OUTPUT
65+
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
66+
echo 'EOF' >> $GITHUB_OUTPUT
67+
else
68+
echo 'text<<EOF' >> $GITHUB_OUTPUT
69+
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
70+
echo 'EOF' >> $GITHUB_OUTPUT
71+
rm release-plan-stderr.txt
72+
fi
73+
env:
74+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- uses: peter-evans/create-pull-request@v6
77+
with:
78+
commit-message: "Prepare Release using 'release-plan'"
79+
labels: "internal"
80+
branch: release-preview
81+
title: Prepare Release
82+
body: |
83+
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 👍
84+
85+
-----------------------------------------
86+
87+
${{ steps.explanation.outputs.text }}

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# For every push to the master branch, this checks if the release-plan was
2+
# updated and if it was it will publish stable npm packages based on the
3+
# release plan
4+
5+
name: Publish Stable
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
14+
concurrency:
15+
group: publish-${{ github.head_ref || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
check-plan:
20+
name: "Check Release Plan"
21+
runs-on: ubuntu-latest
22+
outputs:
23+
command: ${{ steps.check-release.outputs.command }}
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
ref: 'master'
30+
# This will only cause the `check-plan` job to have a result of `success`
31+
# when the .release-plan.json file was changed on the last commit. This
32+
# plus the fact that this action only runs on main will be enough of a guard
33+
- id: check-release
34+
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
35+
36+
publish:
37+
name: "NPM Publish"
38+
runs-on: ubuntu-latest
39+
needs: check-plan
40+
if: needs.check-plan.outputs.command == 'release'
41+
permissions:
42+
contents: write
43+
pull-requests: write
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: wyvox/action-setup-pnpm@v3
48+
with:
49+
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
50+
node-registry-url: 'https://registry.npmjs.org'
51+
52+
- name: npm publish
53+
run: pnpm release-plan publish
54+
55+
env:
56+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_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
### 10.0.0
24

35
* [BREAKING] This addon no longer provides the `moment` library itself. Apps should depend directly on *either* `moment` or `moment-timezone` and import it via `ember-auto-import`. Apps should make sure to remove any dependencies on `ember-cli-moment-shim`. See "Using Moment in Ember Apps & Addons" in the README.

RELEASE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Release Process
2+
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.
4+
5+
## Preparation
6+
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
13+
guiding principle here is that changelogs are for humans, not machines.
14+
15+
When reviewing merged PR's the labels to be used are:
16+
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.
22+
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`
24+
25+
## Release
26+
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/adopted-ember-addons/ember-moment/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"moment",
88
"momentjs"
99
],
10+
"repository": "https://github.com/adopted-ember-addons/ember-moment.git",
1011
"license": "MIT",
1112
"author": "",
1213
"exports": {
@@ -18,7 +19,6 @@
1819
"addon-main.js",
1920
"dist"
2021
],
21-
"repository": "https://github.com/adopted-ember-addons/ember-moment.git",
2222
"scripts": {
2323
"clean": "rm -rf dist node_modules test-app/node_modules",
2424
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
@@ -44,8 +44,8 @@
4444
"devDependencies": {
4545
"@babel/core": "^7.16.7",
4646
"@ember/optional-features": "^2.0.0",
47-
"@ember/test-helpers": "^2.6.0",
4847
"@ember/string": "^3.1.1",
48+
"@ember/test-helpers": "^2.6.0",
4949
"@embroider/addon-dev": "^0.50.2",
5050
"@embroider/compat": "npm:@embroider/compat@latest",
5151
"@embroider/core": "npm:@embroider/core@latest",
@@ -56,6 +56,7 @@
5656
"@rollup/plugin-babel": "^5.3.0",
5757
"babel-eslint": "^10.1.0",
5858
"ember-auto-import": "^2.3.0",
59+
"ember-cli": "~3.28.5",
5960
"ember-cli-3.16": "npm:ember-cli@~3.16.0",
6061
"ember-cli-3.20": "npm:ember-cli@~3.20.0",
6162
"ember-cli-3.24": "npm:ember-cli@~3.24.0",
@@ -66,38 +67,38 @@
6667
"ember-cli-latest": "npm:ember-cli@latest",
6768
"ember-cli-sri": "^2.1.1",
6869
"ember-cli-terser": "^4.0.2",
69-
"ember-cli": "~3.28.5",
7070
"ember-disable-prototype-extensions": "^1.1.3",
7171
"ember-export-application-global": "^2.0.1",
7272
"ember-load-initializers": "^2.1.2",
7373
"ember-maybe-import-regenerator": "0.1.6",
7474
"ember-page-title": "^7.0.0",
7575
"ember-qunit": "^5.1.5",
7676
"ember-resolver": "^8.0.3",
77+
"ember-source": "~3.28.8",
7778
"ember-source-3.16": "npm:ember-source@~3.16.0",
7879
"ember-source-3.20": "npm:ember-source@~3.20.0",
7980
"ember-source-3.24": "npm:ember-source@~3.24.0",
8081
"ember-source-beta": "npm:ember-source@beta",
8182
"ember-source-canary": "npm:ember-source@alpha",
8283
"ember-source-channel-url": "^3.0.0",
8384
"ember-source-latest": "npm:ember-source@latest",
84-
"ember-source": "~3.28.8",
8585
"ember-template-lint": "^3.15.0",
8686
"ember-try": "^1.4.0",
87+
"eslint": "^7.32.0",
8788
"eslint-config-prettier": "^8.3.0",
8889
"eslint-plugin-ember": "^10.5.8",
8990
"eslint-plugin-node": "^11.1.0",
9091
"eslint-plugin-prettier": "^3.4.1",
9192
"eslint-plugin-qunit": "^6.2.0",
92-
"eslint": "^7.32.0",
9393
"jquery": "^3.6.0",
9494
"loader.js": "^4.7.0",
9595
"moment-timezone": "^0.5.33",
9696
"npm-run-all": "^4.1.5",
9797
"prettier": "^2.5.1",
98+
"qunit": "^2.17.2",
9899
"qunit-console-grouper": "^0.3.0",
99100
"qunit-dom": "^1.6.0",
100-
"qunit": "^2.17.2",
101+
"release-plan": "^0.9.0",
101102
"rollup": "^2.63.0",
102103
"scenario-tester": "^2.0.1",
103104
"webpack": "^5.65.0"
@@ -114,9 +115,14 @@
114115
"optional": true
115116
}
116117
},
118+
"packageManager": "pnpm@9.4.0",
117119
"engines": {
118120
"node": ">= 18"
119121
},
122+
"volta": {
123+
"node": "18.20.3",
124+
"pnpm": "9.4.0"
125+
},
120126
"ember-addon": {
121127
"version": 2,
122128
"type": "addon",
@@ -146,10 +152,5 @@
146152
"./helpers/utc.js": "./dist/_app_/helpers/utc.js",
147153
"./services/moment.js": "./dist/_app_/services/moment.js"
148154
}
149-
},
150-
"volta": {
151-
"node": "18.20.3",
152-
"pnpm": "9.4.0"
153-
},
154-
"packageManager": "pnpm@9.4.0"
155+
}
155156
}

0 commit comments

Comments
 (0)