Skip to content

Commit ce3e48f

Browse files
authored
Merge pull request #529 from ember-learn/use-pnpm
start using pnpm
2 parents 85718a7 + 7646f1c commit ce3e48f

File tree

12 files changed

+18701
-62928
lines changed

12 files changed

+18701
-62928
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,43 @@ jobs:
1818
env:
1919
PERCY_TOKEN: ee0a9d5c1122d6a21852edf19b5b309aaec18077fb3900c98995c90bc48ed240
2020
steps:
21-
- uses: actions/checkout@v2
22-
- uses: actions/setup-node@v3
21+
- uses: actions/checkout@v4
22+
- uses: pnpm/action-setup@v4
23+
- uses: actions/setup-node@v4
2324
with:
2425
node-version: 18.x
25-
cache: npm
26-
- run: npm ci
27-
- run: npx percy exec -- npm run test:docs
26+
cache: pnpm
27+
- run: pnpm install
28+
- run: pnpm percy exec -- npm run test:docs
2829

2930
test:
3031
name: "Tests"
3132
runs-on: ubuntu-latest
3233

3334
steps:
34-
- uses: actions/checkout@v2
35-
- uses: mansona/npm-lockfile-version@v1
36-
- uses: actions/setup-node@v3
35+
- uses: actions/checkout@v4
36+
- uses: pnpm/action-setup@v4
37+
- uses: actions/setup-node@v4
3738
with:
3839
node-version: 18.x
39-
cache: npm
40-
- run: npm ci
41-
- run: npm run lint
42-
- run: npx percy exec -- npm run test
40+
cache: pnpm
41+
- run: pnpm install
42+
- run: pnpm run lint
43+
- run: pnpm percy exec -- pnpm run test
4344

4445
floating:
4546
name: "Floating Dependencies"
4647
runs-on: ubuntu-latest
4748

4849
steps:
49-
- uses: actions/checkout@v2
50-
- uses: actions/setup-node@v3
50+
- uses: actions/checkout@v4
51+
- uses: pnpm/action-setup@v4
52+
- uses: actions/setup-node@v4
5153
with:
5254
node-version: 18.x
53-
cache: npm
54-
- run: npm install --no-shrinkwrap
55-
- run: npm run test:ember
55+
cache: pnpm
56+
- run: pnpm install --no-lockfile
57+
- run: pnpm run test:ember
5658

5759
try-scenarios:
5860
name: ${{ matrix.try-scenario }}
@@ -73,12 +75,13 @@ jobs:
7375
- no-deprecations
7476

7577
steps:
76-
- uses: actions/checkout@v2
77-
- uses: actions/setup-node@v3
78+
- uses: actions/checkout@v4
79+
- uses: pnpm/action-setup@v4
80+
- uses: actions/setup-node@v4
7881
with:
7982
node-version: 18.x
80-
cache: npm
81-
- run: npm ci
83+
cache: pnpm
84+
- run: pnpm install
8285
- name: Run Tests
8386
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
8487

@@ -97,12 +100,13 @@ jobs:
97100
- ember-release-no-deprecations
98101

99102
steps:
100-
- uses: actions/checkout@v2
101-
- uses: actions/setup-node@v3
103+
- uses: actions/checkout@v4
104+
- uses: pnpm/action-setup@v4
105+
- uses: actions/setup-node@v4
102106
with:
103107
node-version: 18.x
104-
cache: npm
105-
- run: npm ci
108+
cache: pnpm
109+
- run: pnpm install
106110
- name: Run Tests
107111
id: tests
108112
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14+
- uses: pnpm/action-setup@v4
1415
- uses: mansona/lttf-dashboard@v1
1516
with:
1617
token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/plan-release.yml

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1-
name: Release Plan Review
1+
name: Plan Release
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- main
67
- master
7-
pull_request:
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/
89
types:
910
- labeled
11+
- unlabeled
1012

1113
concurrency:
1214
group: plan-release # only the latest one of these should ever be running
1315
cancel-in-progress: true
1416

1517
jobs:
16-
check-plan:
17-
name: "Check Release Plan"
18+
is-this-a-release:
19+
name: "Is this a release?"
1820
runs-on: ubuntu-latest
1921
outputs:
2022
command: ${{ steps.check-release.outputs.command }}
2123

2224
steps:
2325
- uses: actions/checkout@v4
2426
with:
25-
fetch-depth: 0
27+
fetch-depth: 2
2628
ref: 'master'
27-
# This will only cause the `check-plan` job to have a "command" of `release`
29+
# This will only cause the `is-this-a-release` job to have a "command" of `release`
2830
# when the .release-plan.json file was changed on the last commit.
2931
- id: check-release
3032
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
3133

32-
prepare_release_notes:
33-
name: Prepare Release Notes
34+
create-prepare-release-pr:
35+
name: Create Prepare Release PR
3436
runs-on: ubuntu-latest
3537
timeout-minutes: 5
36-
needs: check-plan
38+
needs: is-this-a-release
3739
permissions:
3840
contents: write
41+
issues: read
3942
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 push event or workflow dispatch if plan wasn't updated (don't create a release plan when we're releasing)
4344
# 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+
if: ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.is-this-a-release.outputs.command != 'release') || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true)
4546

4647
steps:
4748
- uses: actions/checkout@v4
@@ -50,39 +51,41 @@ jobs:
5051
with:
5152
fetch-depth: 0
5253
ref: 'master'
54+
- uses: pnpm/action-setup@v4
5355
- uses: actions/setup-node@v4
5456
with:
5557
node-version: 18
56-
57-
- run: npm ci
58-
58+
cache: pnpm
59+
- run: pnpm install --frozen-lockfile
5960
- name: "Generate Explanation and Prep Changelogs"
6061
id: explanation
6162
run: |
6263
set +e
63-
64-
npx release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
65-
64+
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
6665
6766
if [ $? -ne 0 ]; then
68-
echo 'text<<EOF' >> $GITHUB_OUTPUT
69-
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
70-
echo 'EOF' >> $GITHUB_OUTPUT
67+
release_plan_output=$(cat release-plan-stderr.txt)
7168
else
72-
echo 'text<<EOF' >> $GITHUB_OUTPUT
73-
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
74-
echo 'EOF' >> $GITHUB_OUTPUT
69+
release_plan_output=$(jq .description .release-plan.json -r)
7570
rm release-plan-stderr.txt
71+
72+
if [ $(jq '.solution | length' .release-plan.json) -eq 1 ]; then
73+
new_version=$(jq -r '.solution[].newVersion' .release-plan.json)
74+
echo "new_version=v$new_version" >> $GITHUB_OUTPUT
75+
fi
7676
fi
77+
echo 'text<<EOF' >> $GITHUB_OUTPUT
78+
echo "$release_plan_output" >> $GITHUB_OUTPUT
79+
echo 'EOF' >> $GITHUB_OUTPUT
7780
env:
7881
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
7982

80-
- uses: peter-evans/create-pull-request@v6
83+
- uses: peter-evans/create-pull-request@v7
8184
with:
82-
commit-message: "Prepare Release using 'release-plan'"
85+
commit-message: "Prepare Release ${{ steps.explanation.outputs.new_version}} using 'release-plan'"
8386
labels: "internal"
8487
branch: release-preview
85-
title: Prepare Release
88+
title: Prepare Release ${{ steps.explanation.outputs.new_version }}
8689
body: |
8790
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 👍
8891

.github/workflows/publish.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
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
1+
# For every push to the primary branch with .release-plan.json modified,
2+
# runs release-plan.
43

54
name: Publish Stable
65

@@ -10,50 +9,35 @@ on:
109
branches:
1110
- main
1211
- master
12+
paths:
13+
- '.release-plan.json'
1314

1415
concurrency:
1516
group: publish-${{ github.head_ref || github.ref }}
1617
cancel-in-progress: true
1718

1819
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-
3620
publish:
3721
name: "NPM Publish"
3822
runs-on: ubuntu-latest
39-
needs: check-plan
40-
if: needs.check-plan.outputs.command == 'release'
4123
permissions:
4224
contents: write
4325
pull-requests: write
26+
id-token: write
27+
attestations: write
4428

4529
steps:
4630
- uses: actions/checkout@v4
31+
- uses: pnpm/action-setup@v4
4732
- uses: actions/setup-node@v4
4833
with:
4934
node-version: 18
5035
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
5136
registry-url: 'https://registry.npmjs.org'
52-
53-
- run: npm ci
54-
- name: npm publish
55-
run: npx release-plan publish
56-
37+
cache: pnpm
38+
- run: pnpm install --frozen-lockfile
39+
- name: Publish to NPM
40+
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
5741
env:
5842
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
5943
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
* `git clone <repository-url>`
66
* `cd my-addon`
7-
* `npm install`
7+
* `pnpm install`
88

99
## Linting
1010

11-
* `npm run lint`
12-
* `npm run lint:fix`
11+
* `pnpm run lint`
12+
* `pnpm run lint:fix`
1313

1414
## Running tests
1515

16-
* `npm run test`
16+
* `pnpm run test`
1717
* `ember test` – Runs the test suite on the current Ember version
1818
* `ember test --server` – Runs the test suite in "watch mode"
1919
* `ember try:each` – Runs the test suite against multiple Ember versions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Installation
2525

2626
* `git clone <repository-url>` this repository
2727
* `cd ember-styleguide`
28-
* `npm install`
28+
* `pnpm install`
2929

3030
## Running
3131

RELEASE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Releases in this repo are mostly automated using [release-plan](https://github.c
44

55
## Preparation
66

7-
Since the majority of the actual release process is automated, the remaining tasks before releasing are:
7+
Since the majority of the actual release process is automated, the remaining tasks before releasing are:
88

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
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
1111

1212
Some great information on why this is important can be found at [keepachangelog.com](https://keepachangelog.com/en/1.1.0/), but the overall
1313
guiding principle here is that changelogs are for humans, not machines.
1414

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

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.
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.
2222

2323
**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`
2424

config/ember-try.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
55

66
module.exports = async function () {
77
return {
8+
usePnpm: true,
89
scenarios: [
910
{
1011
name: 'ember-lts-3.28',

0 commit comments

Comments
 (0)