From 73a37ea9fecf59fcbaabfebc89b793e75b083dfa Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 18 May 2023 23:09:11 -0400 Subject: [PATCH 1/5] release preview workflow --- .github/workflows/release-plan-preview.yml | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/release-plan-preview.yml diff --git a/.github/workflows/release-plan-preview.yml b/.github/workflows/release-plan-preview.yml new file mode 100644 index 000000000..1c7abada8 --- /dev/null +++ b/.github/workflows/release-plan-preview.yml @@ -0,0 +1,50 @@ +name: Release Plan Review +on: + push: + branches: + - main + +env: + VOLTA_FEATURE_PNPM: 1 + branch: "gh-workflow/release-preview" + title: "Preview Release" + +jobs: + update_unstable_branch: + name: Update Unstable Branch + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + explanation: ${{ steps.explanation.outputs.text }} + + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - name: 'Prepare git branch' + run: | + set +e + git branch -D ${{ env.branch }} + set -e + git switch -c ${{ env.branch }} + + - id: explanation + run: | + echo "text=$(pnpm embroider-release explain-plan)" >> $GITHUB_OUTPUT + - run: pnpm embroider-release gather-changes + - run: pnpm embroider-release prepare + + - run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions-bot@users.noreply.github.com" + git add . + git commit -m "Automated update" + git push origin ${{ env.branch }} --force + + - uses: peter-evans/create-pull-request@v5 + with: + commit-message: "Prepare Release" + draft: true + branch: ${{ env.branch }} + base: 'main' + title: ${{ env.title }} + body: ${{ steps.explanation.outputs.text }} From 27d4210e71f34dce7ac78b0e4c3356cccd8b13c7 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 22 May 2023 10:51:43 -0400 Subject: [PATCH 2/5] Remove gather-changes --- .github/workflows/release-plan-preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-plan-preview.yml b/.github/workflows/release-plan-preview.yml index 1c7abada8..6eef12354 100644 --- a/.github/workflows/release-plan-preview.yml +++ b/.github/workflows/release-plan-preview.yml @@ -30,7 +30,6 @@ jobs: - id: explanation run: | echo "text=$(pnpm embroider-release explain-plan)" >> $GITHUB_OUTPUT - - run: pnpm embroider-release gather-changes - run: pnpm embroider-release prepare - run: | From 5da5a45e2eafad1f1420f83bc86069dce28400a5 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 22 May 2023 12:28:53 -0400 Subject: [PATCH 3/5] Update from testing --- .github/workflows/release-plan-preview.yml | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-plan-preview.yml b/.github/workflows/release-plan-preview.yml index 6eef12354..fbdc1a97e 100644 --- a/.github/workflows/release-plan-preview.yml +++ b/.github/workflows/release-plan-preview.yml @@ -6,12 +6,12 @@ on: env: VOLTA_FEATURE_PNPM: 1 - branch: "gh-workflow/release-preview" + branch: "embroider-release-preview" title: "Preview Release" jobs: - update_unstable_branch: - name: Update Unstable Branch + prepare_release_notes: + name: Prepare Release Notes runs-on: ubuntu-latest timeout-minutes: 5 outputs: @@ -19,6 +19,10 @@ jobs: steps: - uses: actions/checkout@v3 + # We need to download lots of history so that + # lerna-changelog can discover what's changed since the last release + with: + fetch-depth: 0 - uses: ./.github/actions/setup - name: 'Prepare git branch' run: | @@ -27,17 +31,31 @@ jobs: set -e git switch -c ${{ env.branch }} - - id: explanation + - name: "Configure Git" run: | - echo "text=$(pnpm embroider-release explain-plan)" >> $GITHUB_OUTPUT - - run: pnpm embroider-release prepare - - - run: | git config user.name "github-actions[bot]" git config user.email "github-actions-bot@users.noreply.github.com" - git add . - git commit -m "Automated update" + + - name: "Generate Explanation and Prep Changelogs" + id: explanation + run: | + # Print each command out to the terminal before running + set -x + # For an unknown reason the `pnpm embroider-release` bin is not + # wired up as it is locally. + plan=$(node ./test-packages/release/src/cli.js explain-plan) + node ./test-packages/release/src/cli.js prepare + # Don't print this, because it can be very large + set +x + echo "text=$( echo $plan )" >> $GITHUB_OUTPUT + # For debugging + set -x + git diff + git add -A . + git commit -am "Automated update" git push origin ${{ env.branch }} --force + env: + GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} - uses: peter-evans/create-pull-request@v5 with: From 75c97b7e7daff7c5dd4f488c4ce156974126cbbc Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 22 May 2023 12:50:38 -0400 Subject: [PATCH 4/5] Simplify --- .github/workflows/release-plan-preview.yml | 23 +++------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-plan-preview.yml b/.github/workflows/release-plan-preview.yml index fbdc1a97e..406e5eb96 100644 --- a/.github/workflows/release-plan-preview.yml +++ b/.github/workflows/release-plan-preview.yml @@ -24,18 +24,6 @@ jobs: with: fetch-depth: 0 - uses: ./.github/actions/setup - - name: 'Prepare git branch' - run: | - set +e - git branch -D ${{ env.branch }} - set -e - git switch -c ${{ env.branch }} - - - name: "Configure Git" - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions-bot@users.noreply.github.com" - - name: "Generate Explanation and Prep Changelogs" id: explanation run: | @@ -48,20 +36,15 @@ jobs: # Don't print this, because it can be very large set +x echo "text=$( echo $plan )" >> $GITHUB_OUTPUT - # For debugging - set -x - git diff - git add -A . - git commit -am "Automated update" - git push origin ${{ env.branch }} --force env: GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} - uses: peter-evans/create-pull-request@v5 with: - commit-message: "Prepare Release" + commit-message: "Prepare Release using 'embroider-release'" + author: "github-actions[bot] " + labels: "internal" draft: true branch: ${{ env.branch }} - base: 'main' title: ${{ env.title }} body: ${{ steps.explanation.outputs.text }} From 5ed994a9d76c57515e441c7be343d1b0f2f0e40d Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 22 May 2023 13:44:27 -0400 Subject: [PATCH 5/5] Fix formatting of the PR description --- .github/workflows/release-plan-preview.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-plan-preview.yml b/.github/workflows/release-plan-preview.yml index 406e5eb96..7a1d6dc77 100644 --- a/.github/workflows/release-plan-preview.yml +++ b/.github/workflows/release-plan-preview.yml @@ -35,7 +35,10 @@ jobs: node ./test-packages/release/src/cli.js prepare # Don't print this, because it can be very large set +x - echo "text=$( echo $plan )" >> $GITHUB_OUTPUT + # Have to use this EOF syntax for multi-line strings. + echo 'text<> $GITHUB_OUTPUT + echo "$plan" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT env: GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} @@ -47,4 +50,11 @@ jobs: draft: true branch: ${{ env.branch }} title: ${{ env.title }} - body: ${{ steps.explanation.outputs.text }} + body: | + Preview of the Release. + + See `.github/workflows/release-plan-preview.yml` for how this PR was created. + + ----------------------------------------- + + ${{ steps.explanation.outputs.text }}