-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[ci] Adds github action for creating batch release #10298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1ae6e39
26b3ac9
c4553fe
2857594
6a3ce45
21031ed
b943f8f
ba6a9fe
ee3d451
9866015
b35e54e
941cb78
7335c62
ce2fb73
d3468ea
4dc90ee
fa8af1e
0c999e2
f8cdb22
cfb3385
1be1915
a7f3caf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: "Creates Batch Release for A Package" | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [batch_release_pr] | ||
|
|
||
| jobs: | ||
| create_release_pr: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| BRANCH_NAME: ${{ github.event.client_payload.package }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: checkout repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
| - name: Set up tools | ||
| run: dart pub get | ||
| working-directory: ${{ github.workspace }}/script/tool | ||
| - name: create batch release PR | ||
| run: | | ||
| git config --global user.name ${{ secrets.USER_NAME }} | ||
| git config --global user.email ${{ secrets.USER_EMAIL }} | ||
| dart ./script/tool/lib/src/main.dart branch-for-batch-release --packages=${{ github.event.client_payload.package }} --branch=${{ env.BRANCH_NAME }} --remote=origin | ||
| - name: Check if branch was created | ||
| id: check-branch-exists | ||
| uses: GuillaumeFalourd/branch-exists@v1.1 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am new to GA, not sure if we are allowed to use GA from marketplace, let me know if this is not allowed. Also is there a way to test this locally? |
||
| with: | ||
| branch: ${{ env.BRANCH_NAME }} | ||
|
|
||
| - name: Create Pull Request | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the entire task going to fail as an error if there were no changes (meaning the branch was not created in the previous step)? No-ops should not look like failure when we look at run logs, or it's going to be very hard to notice actual failures.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added condition |
||
| if: steps.check-branch-exists.outputs.exists == 'true' | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: "[${{ github.event.client_payload.package }}] Batch release" | ||
| title: "[${{ github.event.client_payload.package }}] Batch release" | ||
| body: "This PR was created automatically to batch release the `${{ github.event.client_payload.package }}`." | ||
| branch: ${{ env.BRANCH_NAME }} | ||
| base: release | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: "Creates Batch Release for go_router" | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run every Monday at 8:00 AM | ||
| - cron: "0 8 * * 1" | ||
|
|
||
| jobs: | ||
| dispatch_release_pr: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Repository Dispatch | ||
| uses: peter-evans/repository-dispatch@v4 | ||
| with: | ||
| token: "${{ secrets.GITHUB_TOKEN }}" | ||
| event-type: batch_release_pr | ||
| client-payload: '{"package": "go_router"}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Use this file as template to draft a unreleased changelog file. | ||
| # Make a copy of this file in the same directory, rename it, and fill in the details. | ||
| changelog: | | ||
| - Can include a list of changes. | ||
| - with markdown supported. | ||
| version: <major|minor|patch|skip> |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these files are going to be created as part of the PR process, then the tooling should be updated to understand that, and the override labels shouldn't be needed on this PR. If the PR isn't landable without overrides, then the normal commit path isn't working correctly.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that part of the work will be in flutter/flutter#176433.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually if a change to repo structure requires updates to our checks we do those two things in the same PR rather than override our own tooling, so it's not clear to me why this is being done separately. That said, since it's isolated to this package and shouldn't affect any normal PRs for now I guess it's fine.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I don't do the ci check before this pr is that I would like to finalize the yaml content first, and it can't be finalized until the approach of this PR is reviewed and approved. and I think doing it as part of this pr may be too distracting for reviewer |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # This file is for test purposes only. | ||
| # TODO(chuntai): remove this file before publishing. | ||
| changelog: | | ||
| - Adds 'batch' option to CI config for go_router package. | ||
| - Updates GitHub Actions workflow for batch releases of go_router. | ||
| version: major |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # This file is for test purposes only. | ||
| # TODO(chuntai): remove this file before publishing. | ||
| changelog: | | ||
| - Adds some other features | ||
| version: minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the cron job is constantly creating new branches? What cleans up branches that don't actually end up published?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that can be a problem. then I think the right thing to do will be re-use the same branch name and do a clean up before creating a new release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filed flutter/flutter#177748