Visitar URL original
Add some quality of life improvements to the release GitHub workflows. by eyebrowsoffire · Pull Request #183658 · flutter/flutter · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/cut-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:

- name: Configure Git
run: |
git config user.name "[bot] Cut Release Branch"
git config user.email "<>"
git config user.name "flutteractionsbot"
git config user.email "<flutter-actions-bot@google.com>"

- name: Create Branch and Version File
run: |
Expand All @@ -83,3 +83,6 @@ jobs:
- name: Push new branch
run: |
git push origin ${{ env.BRANCH_NAME }}
echo "## Release Branch \`${{ env.BRANCH_NAME }}\` Cut Successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **View Branch** https://github.com/$GITHUB_REPOSITORY/tree/${{ env.BRANCH_NAME }}" >> $GITHUB_STEP_SUMMARY
26 changes: 20 additions & 6 deletions .github/workflows/release-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ jobs:
return;
}

const majorMinorVersion = version.match(/^(\d+\.\d+)/)[0];
const majorMinorVersion = version.match(/^(\d+\.\d+)/)[1];

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.

Isn't our RegExp() matcher also the same? It's a crime I tell'ya.

const branchName = `flutter-${majorMinorVersion}-candidate.0`;

// Build the dynamic checklist
let body = `## Flutter Release\n`;
body += `Candidate Branch: [${branchName}](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${branchName})\n`;
body += `Tag: [${version}](https://github.com/{context.repo.owner}/${context.repo.repo}/releases/tag/${version})\n`;
body += `Tag: [${version}](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${version})\n`;

body += `### 📋 Release Checklist\n\n`;

Expand All @@ -78,7 +78,7 @@ jobs:
body += ' - [ ] Restart the [Dart Auto Roller](https://autoroll.skia.org/r/dart-sdk-flutter)\n';

body += '#### Cut release branches\n';
body += ' - [ ] Cut new flutter branch: `' + branchName + '`\n';
body += ' - [ ] Cut new flutter branch: `' + branchName + '` ' + `([GH Workflow](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/cut-release-branch.yml))\n`;
body += ' - [ ] Cut new recipes branch: `' + branchName + '` [Gerrit UI](https://flutter-review.googlesource.com/admin/repos/recipes,branches)\n';
}

Expand All @@ -88,11 +88,11 @@ jobs:
body += ' - [ ] Create `release-candidate-branch.version` file on candidate branch\n';
} else {
body += `- [ ] Merge outstanding [cherry-picks](https://github.com/${context.repo.owner}/${context.repo.repo}/pulls?q=is%3Apr+is%3Aopen+label%3A"cp%3A+review")\n`;
body += '- [ ] Update Dart version if necessary\n';
body += `- [ ] Update Dart version if necessary ([GH Workflow](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/roll-dart-dependencies.yml))\n`;
body += ' - Dart Hash: [Paste the Dart hash here]\n';
}

body += '- [ ] Pin engine hash in `engine.version` if necessary\n'
body += '- [ ] Pin engine hash in `engine.version` if necessary' + `([GH Workflow](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/sync-engine-version.yml))\n`

if (channel === 'stable' && hotfix === 'true') {
body += '- [ ] Add changelog for stable release\n';
Expand All @@ -114,11 +114,25 @@ jobs:
body += '- [ ] Merge the changelog back to the `master` branch\n';
}

await github.rest.issues.create({
const issueResponse = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `[${channel}] [${releaseType}] Flutter Release Version ${version}`,
body: body,
labels: ['release-tracker'],
assignees: [context.actor],
});

const issueUrl = issueResponse.data.html_url;
const issueNumber = issueResponse.data.number;

// Write a big, friendly button to the Job Summary
await core.summary
.addRaw(`# 🚀 Release Tracker Created!`)
.addBreak()
.addRaw(`The release tracking issue for **${version}** has been successfully generated.`)
.addBreak()
.addRaw(`### [Click here to view Issue #${issueResponse.data.number}](${issueResponse.data.html_url})`)
.addBreak()
.addRaw(`**Assignee:** @${context.actor}`)
.write();
12 changes: 9 additions & 3 deletions .github/workflows/roll-dart-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
# Check if the root DEPS file has changed
if git diff --exit-code DEPS; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "### No-op Success" >> $GITHUB_STEP_SUMMARY
echo "## ✅ Dart version already up to date" >> $GITHUB_STEP_SUMMARY
echo "The DEPS file is already up to date with Dart hash \`${{ inputs.dart_hash }}\`." >> $GITHUB_STEP_SUMMARY
else
echo "changed=true" >> $GITHUB_OUTPUT
Expand All @@ -102,9 +102,15 @@ jobs:
git commit -m "Update flutter DEPS to dart ${{ inputs.dart_hash }}"
git push origin "$BRANCH_NAME" --force

gh pr create \
PR_URL=$(gh pr create \
--title "[${{ github.ref_name }}] Update Flutter DEPS to Dart ${{ inputs.dart_hash }}" \
--body "This PR updates the transitive dependencies in the engine \`DEPS\` file based on Dart SDK hash \`${{ inputs.dart_hash }}\`." \
--repo flutter/flutter \
--base ${{ github.ref_name }} \
--head flutteractionsbot:$BRANCH_NAME
--head flutteractionsbot:$BRANCH_NAME)

# Nice big PR Success Summary
echo "## 🚀 PR Created Successfully" >> $GITHUB_STEP_SUMMARY
echo "Updated dart dependencies to \`${{ inputs.dart_hash }}\`." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **View Pull Request:** $PR_URL" >> $GITHUB_STEP_SUMMARY
47 changes: 27 additions & 20 deletions .github/workflows/sync-engine-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ jobs:
- name: Generate and Capture Hash
id: generate-hash
run: |
chmod +x bin/internal/last_engine_commit.sh

# Run the script and capture the output
ENGINE_HASH=$(./bin/internal/last_engine_commit.sh)

# Save to the version file
echo "$ENGINE_HASH" > bin/internal/engine.version
# Capture the OLD hash (handle case where file doesn't exist)
if [ -f bin/internal/engine.version ]; then
OLD_HASH=$(cat bin/internal/engine.version)

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.

OLD_HASH=$(< bin/internal/engine.version)

Avoids Forking, someone playing with "PATH" for cat, and someone defining a cat function or alias.

else
OLD_HASH="None (New File)"
fi
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_ENV

# Export to environment for later steps
echo "ENGINE_HASH=$ENGINE_HASH" >> $GITHUB_ENV
chmod +x bin/internal/last_engine_commit.sh
NEW_HASH=$(./bin/internal/last_engine_commit.sh)

# Log it to the Action summary for easy viewing
echo "### Generated Engine Hash: \`$ENGINE_HASH\`" >> $GITHUB_STEP_SUMMARY
echo "$NEW_HASH" > bin/internal/engine.version
echo "ENGINE_HASH=$NEW_HASH" >> $GITHUB_ENV

- name: Check for Changes
id: git-check
Expand All @@ -56,9 +56,12 @@ jobs:
# -f adds even if it's in the .gitignore (which it usually is)
git add -N -f bin/internal/engine.version

if git diff --exit-code bin/internal/engine.version; then
if git diff --cached --exit-code bin/internal/engine.version; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected. Skipping PR." >> $GITHUB_STEP_SUMMARY

# Nice big No-Op Summary
echo "## ✅ Engine version already up to date" >> $GITHUB_STEP_SUMMARY
echo "The engine is already at hash \`${{ env.ENGINE_HASH }}\`. No PR was created." >> $GITHUB_STEP_SUMMARY
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
Expand All @@ -68,15 +71,19 @@ jobs:
env:
GH_TOKEN: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }}
run: |
# Make a commit and push to the branch.
git add bin/internal/engine.version
git commit -m "Update engine.version to $(cat bin/internal/engine.version)"
git commit -m "Update engine.version to ${{ env.ENGINE_HASH }}"
git push origin "$BRANCH_NAME"

# Use the GitHub CLI (pre-installed on runners) to create the PR
gh pr create \
# Capture the PR URL
PR_URL=$(gh pr create \
--title "[${{ github.ref_name }}] Sync engine.version to ${{ env.ENGINE_HASH }}" \
--body "Updates the engine.version file." \
--body "Updates the engine.version file from \`${{ env.OLD_HASH }}\` to \`${{ env.ENGINE_HASH }}\`." \
--repo flutter/flutter \
--base ${{ github.ref_name }} \
--head flutteractionsbot:$BRANCH_NAME
--head flutteractionsbot:$BRANCH_NAME)

# Nice big PR Success Summary
echo "## 🚀 PR Created Successfully" >> $GITHUB_STEP_SUMMARY
echo "Updated engine version from \`${{ env.OLD_HASH }}\` to \`${{ env.ENGINE_HASH }}\`." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **View Pull Request:** $PR_URL" >> $GITHUB_STEP_SUMMARY