Skip to content

Commit

Permalink
Merge pull request #624 from adopted-ember-addons/bump-release-plan
Browse files Browse the repository at this point in the history
Bump release-plan and update setup
  • Loading branch information
SergeAstapov authored Nov 14, 2024
2 parents b34b37d + 51b2eb9 commit 7dac5d4
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 261 deletions.
40 changes: 23 additions & 17 deletions .github/workflows/plan-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ on:
branches:
- main
- master
pull_request:
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/
types:
- labeled
- unlabeled

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

jobs:
check-plan:
name: 'Check Release Plan'
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}
Expand All @@ -36,44 +37,49 @@ jobs:
needs: check-plan
permissions:
contents: write
issues: read
pull-requests: write
outputs:
explanation: ${{ steps.explanation.outputs.text }}
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
# only run on labeled event if the PR has already been merged
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true)

steps:
- uses: actions/checkout@v4
# We need to download lots of history so that
# lerna-changelog can discover what's changed since the last release
# github-changelog can discover what's changed since the last release
with:
fetch-depth: 0
ref: 'master'
- uses: actions/setup-node@v4
with:
node-version: 20.x

node-version: 18
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile

- name: 'Generate Explanation and Prep Changelogs'
- name: "Generate Explanation and Prep Changelogs"
id: explanation
run: |
set -x
pnpm release-plan prepare
set +e
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
if [ $? -ne 0 ]; then
echo 'text<<EOF' >> $GITHUB_OUTPUT
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
else
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
rm release-plan-stderr.txt
fi
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
commit-message: "Prepare Release using 'release-plan'"
author: 'github-actions[bot] <[email protected]>'
labels: 'internal'
labels: "internal"
branch: release-preview
title: Prepare Release
body: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For every push to the master branch, this checks if the release-plan was
# updated and if it was it will publish stable npm packages based on the
# release plan
# release plan

name: Publish Stable

Expand All @@ -17,7 +17,7 @@ concurrency:

jobs:
check-plan:
name: 'Check Release Plan'
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}
Expand All @@ -34,7 +34,7 @@ jobs:
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT

publish:
name: 'NPM Publish'
name: "NPM Publish"
runs-on: ubuntu-latest
needs: check-plan
if: needs.check-plan.outputs.command == 'release'
Expand All @@ -46,15 +46,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 18
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
registry-url: 'https://registry.npmjs.org'

- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- name: npm publish
run: pnpm release-plan publish

env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 9 additions & 9 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Release Process

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 prepare the release once the PR is merged.
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.

## Preparation

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

- correctly labeling **all** pull requests that have been merged since the last release
- updating pull request titles so they make sense to our users
- correctly labeling **all** pull requests that have been merged since the last release
- updating pull request titles so they make sense to our users

Some great information on why this is important can be found at [keepachangelog.com](https://keepachangelog.com/en/1.1.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 - Internal changes or things that don't fit in any other category.
* 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 - Internal changes or things that don't fit in any other category.

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"eslint-plugin-qunit": "^6.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"release-plan": "^0.7.0",
"release-plan": "^0.10.0",
"rollup": "^4.22.4",
"scenario-tester": "^3.1.0"
},
Expand Down
Loading

0 comments on commit 7dac5d4

Please sign in to comment.