Skip to content

Commit 7338283

Browse files
Merge pull request #1 from NullVoxPopuli/setup-release-plan
Setup all the GH Workflows
2 parents f522735 + 5cae72f commit 7338283

16 files changed

+1270
-112
lines changed

.github/workflows/ci.yml

+21-35
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
lint:
16+
name: "Lint"
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: wyvox/action-setup-pnpm@v3
23+
- run: pnpm lint
24+
1525
test:
1626
name: "Tests"
1727
runs-on: ubuntu-latest
1828
timeout-minutes: 10
1929

2030
steps:
2131
- uses: actions/checkout@v4
22-
- uses: pnpm/action-setup@v3
23-
with:
24-
version: 8
25-
- uses: actions/setup-node@v4
26-
with:
27-
node-version: 18
28-
cache: pnpm
29-
- name: Install Dependencies
30-
run: pnpm install --frozen-lockfile
31-
- name: Lint
32-
run: pnpm lint
33-
- name: Run Tests
34-
run: pnpm test
32+
- uses: wyvox/action-setup-pnpm@v3
33+
- run: pnpm test:ember
34+
working-directory: test-app
3535

3636
floating:
3737
name: "Floating Dependencies"
@@ -40,17 +40,12 @@ jobs:
4040

4141
steps:
4242
- uses: actions/checkout@v4
43-
- uses: pnpm/action-setup@v3
43+
- uses: wyvox/action-setup-pnpm@v3
4444
with:
45-
version: 8
46-
- uses: actions/setup-node@v4
47-
with:
48-
node-version: 18
49-
cache: pnpm
50-
- name: Install Dependencies
51-
run: pnpm install --no-lockfile
52-
- name: Run Tests
53-
run: pnpm test
45+
args: '--no-lockfile'
46+
- run: pnpm test:ember
47+
working-directory: test-app
48+
5449

5550
try-scenarios:
5651
name: ${{ matrix.try-scenario }}
@@ -62,25 +57,16 @@ jobs:
6257
fail-fast: false
6358
matrix:
6459
try-scenario:
60+
- ember-lts-3.28
6561
- ember-lts-4.12
66-
- ember-lts-5.4
62+
- ember-lts-5.8
6763
- ember-release
6864
- ember-beta
6965
- ember-canary
70-
- embroider-safe
71-
- embroider-optimized
7266

7367
steps:
7468
- uses: actions/checkout@v4
75-
- uses: pnpm/action-setup@v3
76-
with:
77-
version: 8
78-
- uses: actions/setup-node@v4
79-
with:
80-
node-version: 18
81-
cache: pnpm
82-
- name: Install Dependencies
83-
run: pnpm install --frozen-lockfile
69+
- uses: wyvox/action-setup-pnpm@v3
8470
- name: Run Tests
8571
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} --skip-cleanup
8672
working-directory: test-app

.github/workflows/plan-release.yml

+87
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: 'main'
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: 'main'
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

+57
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: 'main'
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 }}

.github/workflows/push-dist.yml

+1-9
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22-
- uses: pnpm/action-setup@v3
23-
with:
24-
version: 8
25-
- uses: actions/setup-node@v4
26-
with:
27-
node-version: 18
28-
cache: pnpm
29-
- name: Install Dependencies
30-
run: pnpm install --frozen-lockfile
22+
- uses: wyvox/action-setup-pnpm@v3
3123
- uses: kategengler/put-built-npm-package-contents-on-branch@v2.0.0
3224
with:
3325
branch: dist

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

RELEASE.md

+27
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/NullVoxPopuli/ember-classic-import-meta-glob/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

ember-classic-import-meta-glob/addon/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
/* globals requirejs */
12
import { assert } from '@ember/debug';
3+
24
import pico from 'picomatch';
35

46
/**
@@ -31,11 +33,11 @@ export function importMetaGlob(glob, options, modulePath) {
3133
* 4. chop off the directory from the results to match the same relativeness
3234
*
3335
*/
34-
let [_last, ...reversedParts] = modulePath.split('/').reverse();
36+
let [, ...reversedParts] = modulePath.split('/').reverse();
3537
let currentDir = reversedParts.reverse().join('/');
3638

3739
let fullGlobs = Array.isArray(glob)
38-
? glob.map((g) => `${modulePath}${g}`)
40+
? glob.map((g) => `${currentDir}${g}`)
3941
: [`${modulePath}${glob}`];
4042
let isMatch = pico(fullGlobs);
4143
let matches = allModules.filter(isMatch);

ember-classic-import-meta-glob/babel-plugin.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
const { ImportUtil } = require('babel-import-util');
2-
const {
3-
callExpression,
4-
memberExpression,
5-
identifier,
6-
stringLiteral,
7-
} = require('@babel/types');
2+
const { callExpression, stringLiteral } = require('@babel/types');
83

94
// DEBUG:
105
// https://astexplorer.net/#/gist/a72d97261099f82aac7be47112f66158/7e984bd728c0a4e9af4911b065f776aa21d68a7d

ember-classic-import-meta-glob/ember-addon-main.cjs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const path = require('path');
44
const { hasPlugin, addPlugin } = require('ember-cli-babel-plugin-helpers');
55
const pluginPath = path.join(__dirname, './babel-plugin.cjs');
6-
const Plugin = require.resolve(pluginPath);
76

87
module.exports = {
98
name: require('./package').name,

ember-classic-import-meta-glob/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
"devDependencies": {
2323
"@babel/core": "^7.23.6",
2424
"@babel/eslint-parser": "^7.23.3",
25+
"@babel/plugin-proposal-decorators": "^7.24.1",
2526
"@nullvoxpopuli/eslint-configs": "^4.0.0",
27+
"@typescript-eslint/eslint-plugin": "^7.11.0",
28+
"@typescript-eslint/parser": "^7.11.0",
2629
"concurrently": "^8.2.2",
2730
"eslint": "^8.56.0",
2831
"eslint-config-prettier": "^9.1.0",
@@ -31,7 +34,8 @@
3134
"eslint-plugin-n": "^16.4.0",
3235
"eslint-plugin-prettier": "^5.0.1",
3336
"prettier": "^3.1.1",
34-
"prettier-plugin-ember-template-tag": "^1.1.0"
37+
"prettier-plugin-ember-template-tag": "^1.1.0",
38+
"typescript": "^5.4.5"
3539
},
3640
"publishConfig": {
3741
"registry": "https://registry.npmjs.org"

package.json

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
{
22
"private": true,
3-
"repository": "",
3+
"repository": {
4+
"type": "git",
5+
"url": "git@github.com:NullVoxPopuli/ember-classic-import-meta-glob.git"
6+
},
47
"license": "MIT",
58
"author": "",
69
"scripts": {
7-
"build": "pnpm --filter ember-classic-import-meta-glob build",
810
"lint": "pnpm --filter '*' lint",
9-
"lint:fix": "pnpm --filter '*' lint:fix",
10-
"prepare": "pnpm build",
11-
"start": "concurrently 'pnpm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
12-
"start:addon": "pnpm --filter ember-classic-import-meta-glob start --no-watch.clearScreen",
13-
"start:test-app": "pnpm --filter test-app start",
14-
"test": "pnpm --filter '*' test",
15-
"test:ember": "pnpm --filter '*' test:ember"
11+
"lint:fix": "pnpm --filter '*' lint:fix"
1612
},
1713
"devDependencies": {
1814
"concurrently": "^8.2.0",
1915
"prettier": "^3.0.3",
20-
"prettier-plugin-ember-template-tag": "^1.1.0"
16+
"prettier-plugin-ember-template-tag": "^1.1.0",
17+
"release-plan": "^0.9.0"
2118
},
2219
"pnpm": {
2320
"overrides": {
2421
"@types/eslint": "^7.0.0"
2522
}
2623
}
27-
}
24+
}

0 commit comments

Comments
 (0)