ci: setup PR-driven release - #23116
Conversation
2f0d172 to
1754366
Compare
bluwy
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
vite/scripts/detect-release.ts
Lines 9 to 10 in 84c63e4
There was a problem hiding this comment.
Couldn't it be something like this?
- uses: vitejs/release-scripts/detect-release@v1
with:
packages: vite,create-vite,plugin-legacy
default-package: viteThere was a problem hiding this comment.
Ah, I was saying things wrong. I meant we need to duplicate the packages list here and for prepare-release to do so
There was a problem hiding this comment.
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.
| - 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 |
There was a problem hiding this comment.
Couldn't we use the default github token here?
| - 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Would also be nice if this is an action so can be used directly without a script, but not important right now.
Setup the PR-driven release for like the plugin-react repo does.
needs vitejs/release-scripts#120