Skip to content

ci: setup PR-driven release - #23116

Open
sapphi-red wants to merge 8 commits into
mainfrom
ci/setup-pr-driven-release
Open

ci: setup PR-driven release#23116
sapphi-red wants to merge 8 commits into
mainfrom
ci/setup-pr-driven-release

Conversation

@sapphi-red

@sapphi-red sapphi-red commented Jul 31, 2026

Copy link
Copy Markdown
Member

Setup the PR-driven release for like the plugin-react repo does.

needs vitejs/release-scripts#120

Comment thread .github/workflows/prepare-release.yml Outdated
Comment thread .github/workflows/prepare-release.yml Fixed
@sapphi-red
sapphi-red marked this pull request as ready for review August 6, 2026 07:06
@sapphi-red sapphi-red added the p1-chore Doesn't change code behavior (priority) label Aug 6, 2026
bluwy
bluwy previously approved these changes Aug 7, 2026

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if we can move more of the custom scripts as actions from release-scripts, I've commented some below, but I'm ok with this for now and see what works, then we can better abstract them out later.


- name: Detect release
id: detect
run: node scripts/detect-release.ts "$(git log -1 --format=%s)" >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is bundled as a release-scripts action, perhaps we don't need all the steps here and can compute all from within the action.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that, we need to move these options to either a CLI flag or a config file. That also didn't feel simple compared to the current way.

packages: releasePackages,
defaultPackage: 'vite',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't it be something like this?

- uses: vitejs/release-scripts/detect-release@v1
  with:
    packages: vite,create-vite,plugin-legacy
    default-package: vite

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was saying things wrong. I meant we need to duplicate the packages list here and for prepare-release to do so

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it's ok because we also hardcode the list in the workflow_dispatch. And maybe prepare-release.js could also have most of the stuff as an action. But anyways I think I'm thinking too far here and it's not important to address this now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's true.

Comment thread .github/workflows/publish.yml Outdated
Comment on lines +95 to +102
- id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.RELEASE_GITHUB_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_GITHUB_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we use the default github token here?

Comment on lines +76 to +84
- id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.RELEASE_GITHUB_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_GITHUB_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
permission-pull-requests: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possibly also use the default github token here too? (with the permissions set) unless the goal here is to have a specific bot name opening the PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have "Allow GitHub Actions to create and approve pull requests" option enabled so I guess we can. It's aligned with Vitest's approach. @hi-ogawa is that the reason?

TAG: ${{ needs.detect-release.outputs.tag }}
VERSION: ${{ needs.detect-release.outputs.version }}
run: |
node scripts/extract-changelog.ts "packages/$PACKAGE/CHANGELOG.md" "$VERSION" > "$NOTES_FILE"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also be nice if this is an action so can be used directly without a script, but not important right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p1-chore Doesn't change code behavior (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants