Skip to content

Commit

Permalink
Merge pull request #4 from ef4/update-release-plan
Browse files Browse the repository at this point in the history
Update release-plan workflows
  • Loading branch information
mansona authored Dec 3, 2023
2 parents c088306 + 28db8bc commit c0dfae7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/plan-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,42 @@ on:
push:
branches:
- main
- master
pull_request:
types:
types:
- labeled

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"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'master'
# 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

prepare_release_notes:
name: Prepare Release Notes
runs-on: ubuntu-latest
timeout-minutes: 5
needs: check-plan
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' || (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' && github.event.pull_request.merged == true)

steps:
- uses: actions/checkout@v4
Expand All @@ -30,19 +49,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install --frozen-lockfile

- name: "Generate Explanation and Prep Changelogs"
id: explanation
run: |
set -x
pnpm release-plan prepare
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
Expand All @@ -61,4 +80,4 @@ jobs:
-----------------------------------------
${{ steps.explanation.outputs.text }}
${{ steps.explanation.outputs.text }}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
ref: 'master'
# 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
Expand Down

0 comments on commit c0dfae7

Please sign in to comment.