-
Notifications
You must be signed in to change notification settings - Fork 370
fix(repo): fix pub release ci #2273
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
Conversation
WalkthroughThe release workflow was restructured by deleting Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant release_publish_job
participant pub_dev
participant GitHub API
participant git_repo
GitHub Actions->>release_publish_job: Trigger on push tag vX.Y.Z
release_publish_job->>git_repo: Checkout repo with full history
release_publish_job->>release_publish_job: Setup Dart SDK and Flutter
release_publish_job->>release_publish_job: Activate Melos and bootstrap workspace
release_publish_job->>release_publish_job: Run lint on pubspec files
release_publish_job->>pub_dev: Publish packages via Melos
release_publish_job->>release_publish_job: Extract version and prerelease flag
release_publish_job->>GitHub API: Create GitHub release with autogenerated notes
Suggested reviewers
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/release_github.yml (1)
6-6
: Consider adding inputs for manual triggers
Allow users to specify the release tag (and whether it’s a prerelease) when running manually, rather than relying solely on the commit message.Example addition:
on: workflow_dispatch: + inputs: + tag: + description: 'The semver tag to release (e.g. v1.2.3)' + required: true + prerelease: + description: 'Publish as a prerelease?' + required: false + default: 'false'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/release_github.yml
(1 hunks).github/workflows/release_pub.yml
(1 hunks)
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/release_publish.yml (2)
69-73
: Version regex and pre-release detection.The regex
version_regex='[vV][0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.\-]+)?'
correctly matches SemVer with optional pre-release. Theis_prerelease
logic is concise.You might consider anchoring the pattern (e.g.,
^...$
) or using word boundaries (\b
) if you anticipate more complex commit messages.
84-90
: GitHub Release action configuration.
softprops/action-gh-release@v1
withgenerate_release_notes
is a solid choice. You may also use the defaultGITHUB_TOKEN
instead of a customBOT_GITHUB_API_TOKEN
unless there’s a specific need.🧰 Tools
🪛 actionlint (1.7.7)
85-85: the runner of "softprops/action-gh-release@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 YAMLlint (1.37.1)
[error] 90-90: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/release_pub.yml
(0 hunks).github/workflows/release_publish.yml
(2 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/release_pub.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: stream_chat_localizations
🔇 Additional comments (7)
.github/workflows/release_publish.yml (7)
1-1
: Skip workflow name change.The workflow name has been updated to
release_publish
. This is a trivial rename with no functional impact.
11-12
: Review concurrency group naming.The concurrency group is set to
${{ github.workflow }}-${{ github.ref }}
. This will serialize workflow runs per branch/ref, which is usually fine for releases. Ensure this level of throttling matches your release cadence.
15-21
: Conditional run and permissions forpublish_pub
.The
publish_pub
job correctly gates on commit messages and uses OIDC (id-token: write
) for secure authentication with pub.dev. Verify that all contributors understand the commit-message convention (chore(repo): release
).
24-46
: Publish to pub.dev steps look good.The sequence of steps—checkout, setup Dart & Flutter, activate Melos, bootstrap, lint, and publish—is well-structured and verbose for debugging.
47-52
:publish_github
job header is correct.The job depends on
publish_pub
and has the necessarycontents: write
permission for creating releases.
55-63
: Check out and extraction step configuration.Using
actions/checkout@v4
withfetch-depth: 0
is appropriate for accessing full history if needed. Theextract_tag
step is correctly wired up withbash
.🧰 Tools
🪛 actionlint (1.7.7)
63-63: "github.event.head_commit.message" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions for more details
(expression)
77-79
: Emit outputs to GitHub Actions correctly.Writing
tag
andprerelease
to$GITHUB_OUTPUT
follows the latest guidance.
02383ff
to
7284c17
Compare
7284c17
to
e17bf2f
Compare
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/release_tag.yml (1)
53-56
: Remove trailing whitespace and add EOF newline
YAMLlint flags trailing spaces and missing newline at end of file. Please strip trailing blanks on line 53 and ensure the file ends with a single newline.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_publish.yml (1)
48-55
: Remove trailing spaces & add EOF newline
YAMLlint flags trailing whitespace on lines 48, 51, and 55, and missing newline at end of file. Please clean up these minor formatting issues.Also applies to: 65-65
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/release_pub.yml
(0 hunks).github/workflows/release_publish.yml
(1 hunks).github/workflows/release_tag.yml
(3 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/release_pub.yml
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/release_tag.yml
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_publish.yml
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[error] 65-65: no new line character at the end of file
(new-line-at-end-of-file)
🪛 actionlint (1.7.7)
.github/workflows/release_publish.yml
60-60: the runner of "softprops/action-gh-release@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (15)
.github/workflows/release_tag.yml (5)
1-2
: Workflow rename is correct
The workflow name has been updated torelease_tag
to reflect its focus on tag creation.
12-14
: Job name updated tocreate_tag
Renaming the job fromrelease
tocreate_tag
aligns with its new responsibility of generating and pushing git tags.
16-18
: Explicit write permission for contents
Grantingcontents: write
is necessary for tag creation and pushing, and follows least-privilege principles.
24-25
: Checkout with bot token
Usingfetch-depth: 0
plus the bot token ensures full history is available for tagging.
48-56
: Create & push tag step looks good
Configuration of git user details, tag creation, and push commands are correct and will run reliably.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_publish.yml (10)
8-11
: Concurrency settings are appropriate
Cancel-in-progress on the same workflow/ref prevents duplicate publishes.
13-16
: Permissions scoped correctly for OIDC
id-token: write
is required for Dart pub authentication via OIDC.
17-23
: Checkout step is well configured
Usingactions/checkout@v4
with full history and the bot token aligns with best practices for publishing workflows.
24-27
: Setup Dart SDK step is correct
dart-lang/setup-dart@v1
will provision the required SDK for pub operations.
28-30
: Install Flutter step is fine
subosito/flutter-action@v2
will prepare Flutter for Melos and other tooling.
31-33
: Global tool installation is solid
Activating Melos globally ensures consistent releases across the mono-repo.
34-36
: Workspace bootstrap is appropriate
melos bootstrap --verbose
readies all packages for linting and publishing.
37-39
: Dry run lint check looks good
Runningmelos run lint:pub
before publishing helps catch issues early.
40-42
: Publish to pub.dev step is configured correctly
melos run release:pub
will handle the actual package publication.
43-58
: Version extraction & prerelease detection are solid
Usinggithub.ref_name
and checking for-
correctly sets theprerelease
flag for the GitHub Release.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
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.
Actionable comments posted: 0
♻️ Duplicate comments (2)
.github/workflows/release_publish.yml (2)
61-62
: 🛠️ Refactor suggestionPin
softprops/action-gh-release
to a fixed patch version
Locking to@v2
is too broad and may introduce breaking changes. Pin to the latest stable patch (e.g.,@v2.2.2
) for greater stability.
5-6
: 🛠️ Refactor suggestion
⚠️ Potential issueAllow prerelease tags to trigger this workflow
The current regex only matchesvX.Y.Z
, so prerelease tags likev1.2.3-beta
won’t fire the job. Please extend the pattern to include an optional suffix.Apply this diff:
- - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.\-]+)?'
🧹 Nitpick comments (2)
.github/workflows/release_publish.yml (2)
49-49
: Remove trailing whitespace
Lines 49, 52, and 56 include unnecessary trailing spaces. Please trim these to satisfy YAML lint rules.Also applies to: 52-52, 56-56
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 49-49: trailing spaces
(trailing-spaces)
66-66
: Add newline at end of file
A final newline is required by POSIX and YAML linters.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 66-66: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/release_publish.yml
(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/release_publish.yml
[error] 49-49: trailing spaces
(trailing-spaces)
[error] 52-52: trailing spaces
(trailing-spaces)
[error] 56-56: trailing spaces
(trailing-spaces)
[error] 66-66: no new line character at the end of file
(new-line-at-end-of-file)
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/release_tag.yml (1)
53-56
: Remove trailing whitespace and add newline
- Line 53 has trailing spaces.
- Line 56 is missing a terminating newline.
- git config user.email "60655709+Stream-SDK-Bot@users.noreply.github.com" + git config user.email "60655709+Stream-SDK-Bot@users.noreply.github.com" # Add a newline at end of file +🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_publish.yml (2)
63-63
: Pin release action to a fixed versionLock
softprops/action-gh-release
to a specific minor tag to avoid breaking changes in futurev2
releases:- uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v2.2.2
51-58
: Remove trailing whitespace and add newlineTrailing spaces detected at lines 51, 54, and 58; also add a newline at the end of the file.
- | + | - echo "📦 Tag: $tag_name" + echo "📦 Tag: $tag_name" - is_prerelease=$([[ $tag_name == *-* ]] && echo true || echo false) + is_prerelease=$([[ $tag_name == *-* ]] && echo true || echo false) # Add newline at end of file +Also applies to: 68-68
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 54-54: trailing spaces
(trailing-spaces)
[error] 58-58: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/release_publish.yml
(1 hunks).github/workflows/release_tag.yml
(3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/release_publish.yml
[error] 51-51: trailing spaces
(trailing-spaces)
[error] 54-54: trailing spaces
(trailing-spaces)
[error] 58-58: trailing spaces
(trailing-spaces)
[error] 68-68: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_tag.yml
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (7)
.github/workflows/release_tag.yml (3)
16-18
: Correct use of permissions for tag creationThe
contents: write
permission is correctly scoped for creating and pushing tags.
24-24
: Proper checkout token usageUsing
secrets.BOT_GITHUB_API_TOKEN
to authenticate the checkout step ensures the workflow can push tags without relying on the defaultGITHUB_TOKEN
.
48-56
: Manual tag creation and push stepsThe explicit git configuration, tag creation, and push commands correctly replace the previous release action and fulfill the tagging workflow.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 53-53: trailing spaces
(trailing-spaces)
[error] 56-56: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/release_publish.yml (4)
8-8
: Manual dispatch enabledAllowing
workflow_dispatch
grants the flexibility to trigger this workflow manually, which aligns with release management needs.
17-18
: Permissions for release publish job
contents: write
andid-token: write
are correctly set for creating releases and using OIDC.
24-25
: Checkout step with proper tokenFetching full history and authenticating with the bot token is essential for workspace bootstrapping and release.
52-57
: Version extraction logicThe bash snippet correctly captures
github.ref_name
and derives theprerelease
flag based on the presence of a hyphen.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 54-54: trailing spaces
(trailing-spaces)
Description
We have to use the tag push trigger instead of published because publishing on pub.dev is only allowed from 'tag' refType.
The new workflow is now
Tested here: https://github.com/xsahil03botx/stream-automatic-release-test
Summary by CodeRabbit