Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 18 additions & 48 deletions .github/workflows/plan-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Release Plan Review
name: Plan Release
on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -14,75 +15,44 @@ concurrency:
cancel-in-progress: true

jobs:
check-plan:
name: "Check Release Plan"
should-run-release-plan-prepare:
name: Should we run release-plan prepare?
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}

should-prepare: ${{ steps.should-prepare.outputs.should-prepare }}
steps:
- uses: actions/checkout@v4
- uses: release-plan/actions/should-prepare-release@v1
with:
fetch-depth: 0
ref: 'main'
# This will only cause the `check-plan` job to have a "command" of `release`
# when the .release-plan.json file was changed on the last commit.
- id: check-release
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
id: should-prepare

prepare-release-notes:
name: Prepare Release Notes
create-prepare-release-pr:
name: Create Prepare Release PR
runs-on: ubuntu-latest
timeout-minutes: 5
needs: check-plan
needs: should-run-release-plan-prepare
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_target' && github.event.pull_request.merged == true)

if: needs.should-run-release-plan-prepare.outputs.should-prepare == 'true'
steps:
- uses: actions/checkout@v4
# We need to download lots of history so that
# github-changelog can discover what's changed since the last release
- uses: release-plan/actions/prepare@v1
name: Run release-plan prepare
with:
fetch-depth: 0
ref: 'main'
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: "Generate Explanation and Prep Changelogs"
id: explanation
run: |
set +e
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)

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 }}
id: explanation

- uses: peter-evans/create-pull-request@v7
name: Create Prepare Release PR
with:
commit-message: "Prepare Release using 'release-plan'"
commit-message: "Prepare Release ${{ steps.explanation.outputs.new-version}} using 'release-plan'"
labels: "internal"
sign-commits: true
branch: release-preview
title: Prepare Release
title: Prepare Release ${{ steps.explanation.outputs.new-version }}
body: |
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 👍

Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# 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
# For every push to the primary branch with .release-plan.json modified,
# runs release-plan.

name: Publish Stable

Expand All @@ -10,52 +9,33 @@ on:
branches:
- main
- master
paths:
- '.release-plan.json'

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

jobs:
check-plan:
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
# This will only cause the `check-plan` job to have a result of `success`
# when the .release-plan.json file was changed on the last commit. This
# plus the fact that this action only runs on main will be enough of a guard
- id: check-release
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"
runs-on: ubuntu-latest
needs: check-plan
if: needs.check-plan.outputs.command == 'release'
permissions:
contents: write
pull-requests: write
id-token: write
attestations: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: 18
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: npm publish
- run: npm install -g npm@latest # ensure that the globally installed npm is new enough to support OIDC
- name: Publish to NPM
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"eslint": "8.55.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "4.2.1",
"execa-latest": "npm:execa@^9.6.0",
"fs-extra": "10.1.0",
"prettier": "2.8.8",
"release-plan": "^0.11.0",
"release-plan": "^0.17.0",
"rimraf": "3.0.2",
"typescript": "5.0.4",
"vitest": "^3.0.4",
"execa-latest": "npm:execa@^9.6.0"
"vitest": "^3.0.4"
},
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af",
"engines": {
Expand Down
Loading