Skip to content

Commit b314944

Browse files
authored
[ci] Adds github action for creating batch release (#10298)
fixes flutter/flutter#176425 To set up a batch release cron job for a package, one needs to make a copy of packages/.github/workflows/go_router_batch.yml, and change the name and cron schedule. The cron job does the following: 1. trigger batch_release_pr.yaml with the input package batch_release_pr: 1. check out repo 2. Run script/tool/lib/src/branch_for_batch_release_command.dart to create branches with all the changes 3. create pr request ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 11bf223 commit b314944

File tree

8 files changed

+1092
-1
lines changed

8 files changed

+1092
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Creates Batch Release for A Package"
2+
3+
on:
4+
repository_dispatch:
5+
types: [batch_release_pr]
6+
7+
jobs:
8+
create_release_pr:
9+
runs-on: ubuntu-latest
10+
env:
11+
BRANCH_NAME: ${{ github.event.client_payload.package }}-${{ github.run_id }}-${{ github.run_attempt }}
12+
steps:
13+
- name: checkout repository
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
15+
- name: Set up tools
16+
run: dart pub get
17+
working-directory: ${{ github.workspace }}/script/tool
18+
# This step is to create a branch for batch release
19+
# A branch may not be created if there is nothing to release.
20+
# In that case, the workflow will exit and complete successfully.
21+
- name: create batch release PR
22+
run: |
23+
git config --global user.name ${{ secrets.USER_NAME }}
24+
git config --global user.email ${{ secrets.USER_EMAIL }}
25+
dart ./script/tool/lib/src/main.dart branch-for-batch-release --packages=${{ github.event.client_payload.package }} --branch=${{ env.BRANCH_NAME }} --remote=origin
26+
- name: Check if branch was created
27+
id: check-branch-exists
28+
uses: GuillaumeFalourd/[email protected]
29+
with:
30+
branch: ${{ env.BRANCH_NAME }}
31+
32+
- name: Create Pull Request
33+
if: steps.check-branch-exists.outputs.exists == 'true'
34+
uses: peter-evans/create-pull-request@v7
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
commit-message: "[${{ github.event.client_payload.package }}] Batch release"
38+
title: "[${{ github.event.client_payload.package }}] Batch release"
39+
body: "This PR was created automatically to batch release the `${{ github.event.client_payload.package }}`."
40+
branch: ${{ env.BRANCH_NAME }}
41+
base: release
42+
43+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Creates Batch Release for go_router"
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 8:00 AM
6+
- cron: "0 8 * * 1"
7+
8+
jobs:
9+
dispatch_release_pr:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Repository Dispatch
13+
uses: peter-evans/repository-dispatch@v4
14+
with:
15+
token: "${{ secrets.GITHUB_TOKEN }}"
16+
event-type: batch_release_pr
17+
client-payload: '{"package": "go_router"}'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Use this file as template to draft a unreleased changelog file.
2+
# Make a copy of this file in the same directory, rename it, and fill in the details.
3+
changelog: |
4+
- Can include a list of changes.
5+
- with markdown supported.
6+
version: <major|minor|patch|skip>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is for test purposes only.
2+
# TODO(chuntai): remove this file before publishing.
3+
changelog: |
4+
- Adds 'batch' option to CI config for go_router package.
5+
- Updates GitHub Actions workflow for batch releases of go_router.
6+
version: major
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is for test purposes only.
2+
# TODO(chuntai): remove this file before publishing.
3+
changelog: |
4+
- Adds some other features
5+
version: minor

0 commit comments

Comments
 (0)