From 9050039fb7bbb0055fb896650f95f58fa15182a2 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Tue, 12 Mar 2024 17:31:28 +0000 Subject: [PATCH] update release-plan-setup I ran `npm init release-plan-setup@latest` (I know, very meta!) and made sure it was still pointing at the local release-plan --- .github/workflows/plan-release.yml | 39 ++++++++++++++++++------------ .github/workflows/publish.yml | 9 ++++--- RELEASE.md | 2 +- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/workflows/plan-release.yml b/.github/workflows/plan-release.yml index 5c1b48d..05a14fe 100644 --- a/.github/workflows/plan-release.yml +++ b/.github/workflows/plan-release.yml @@ -5,7 +5,7 @@ on: - main - master pull_request: - types: + types: - labeled concurrency: @@ -34,6 +34,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 needs: check-plan + permissions: + contents: write + 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) @@ -43,35 +46,41 @@ jobs: 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: 'main' - uses: actions/setup-node@v4 with: node-version: 18 - - - uses: pnpm/action-setup@v2 + + - uses: pnpm/action-setup@v3 with: version: 8 - run: pnpm install --frozen-lockfile - + - name: "Generate Explanation and Prep Changelogs" id: explanation run: | - set -x - - node ./dist/cli.js prepare --single-package=release-plan - - echo 'text<> $GITHUB_OUTPUT - jq .description .release-plan.json -r >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT + set +e + + node ./dist/cli.js prepare prepare 2> >(tee -a stderr.log >&2) + + if [ $? -ne 0 ]; then + echo 'text<> $GITHUB_OUTPUT + cat stderr.log >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + else + echo 'text<> $GITHUB_OUTPUT + jq .description .release-plan.json -r >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + 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] " labels: "internal" branch: release-preview title: Prepare Release @@ -80,4 +89,4 @@ jobs: ----------------------------------------- - ${{ steps.explanation.outputs.text }} \ No newline at end of file + ${{ steps.explanation.outputs.text }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2474c07..8987fc9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -38,6 +38,9 @@ jobs: runs-on: ubuntu-latest needs: check-plan if: needs.check-plan.outputs.command == 'release' + permissions: + contents: write + pull-requests: write steps: - uses: actions/checkout@v4 @@ -47,7 +50,7 @@ jobs: # This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable registry-url: 'https://registry.npmjs.org' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v3 with: version: 8 - run: pnpm install --frozen-lockfile @@ -55,4 +58,4 @@ jobs: run: node ./dist/cli.js publish env: GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/RELEASE.md b/RELEASE.md index 83eb4c5..dee9e8e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ # 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