-
Notifications
You must be signed in to change notification settings - Fork 103
feat: Document release process in RELEASE.md #560
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
Open
kabir
wants to merge
4
commits into
a2aproject:main
Choose a base branch
from
kabir:release-process
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Fetch the property from the Maven project | ||
| def scriptName = project.properties['jbang.script.name'] | ||
|
|
||
| // Fail if the script property is missing | ||
| if (scriptName == null) { | ||
| throw new IllegalStateException("[ERROR] JBang validator: No jbang.script.name set in properties") | ||
| } | ||
|
|
||
| def jbangFile = new File(project.basedir, scriptName) | ||
| if (!jbangFile.exists()) { | ||
| // If a script name was explicitly provided but doesn't exist, fail. | ||
| // If using the fallback, we might want to just skip (return true). | ||
| throw new IllegalStateException("[ERROR] JBang validator: File not found: " + jbangFile.absolutePath) | ||
| } | ||
|
|
||
| def expectedVersion = project.version | ||
| def groupPrefix = "//DEPS io.github.a2asdk:" | ||
| def success = true | ||
|
|
||
| jbangFile.eachLine { line -> | ||
| if (line.trim().startsWith(groupPrefix)) { | ||
| def lastColon = line.lastIndexOf(":") | ||
| if (lastColon != -1) { | ||
| def actualVersion = line.substring(lastColon + 1).trim().tokenize()[0] | ||
| if (actualVersion != expectedVersion) { | ||
| System.err.println("[ERROR] JBang Version Mismatch in " + scriptName) | ||
| System.err.println(" Expected: " + expectedVersion) | ||
| System.err.println(" Found: " + actualVersion + " in line: \"" + line.trim() + "\"") | ||
| success = false | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!success) { | ||
| throw new IllegalStateException("[ERROR] JBang version validation failed") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| name: Create GitHub Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v?[0-9]+.[0-9]+.[0-9]+*' # Trigger on tags like v1.0.0, 1.2.3, v1.2.3.Alpha1 etc. | ||
|
|
||
| jobs: | ||
| create-release: | ||
| # Only run this job for the main repository, not for forks | ||
| if: github.repository == 'a2aproject/a2a-java' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # Required to create releases | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch all history for changelog generation | ||
|
|
||
| - name: Extract version from tag | ||
| id: version | ||
| run: | | ||
| # Remove 'v' prefix if present | ||
| VERSION=${GITHUB_REF_NAME#v} | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Version: $VERSION" | ||
|
|
||
| - name: Generate release notes | ||
| id: release_notes | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const version = '${{ steps.version.outputs.version }}'; | ||
|
|
||
| // Get the previous tag | ||
| let previousTag = ''; | ||
| try { | ||
| const { data: tags } = await github.rest.repos.listTags({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| per_page: 100 | ||
| }); | ||
|
|
||
| // Find current tag index | ||
| const currentIndex = tags.findIndex(tag => tag.name === context.ref.replace('refs/tags/', '')); | ||
|
|
||
| // Get previous tag (next in list) | ||
| if (currentIndex >= 0 && currentIndex < tags.length - 1) { | ||
| previousTag = tags[currentIndex + 1].name; | ||
| } | ||
| } catch (error) { | ||
| console.log('Could not fetch previous tag:', error.message); | ||
| } | ||
|
|
||
| // Build release notes | ||
| let releaseNotes = `## A2A Java SDK ${version}\n\n`; | ||
|
|
||
| // Add Maven Central installation instructions | ||
| releaseNotes += `### Installation\n\n`; | ||
| releaseNotes += `**Maven**:\n\`\`\`xml\n<dependency>\n`; | ||
| releaseNotes += ` <groupId>io.github.a2asdk</groupId>\n`; | ||
| releaseNotes += ` <artifactId>a2a-java-sdk-client</artifactId>\n`; | ||
| releaseNotes += ` <version>${version}</version>\n`; | ||
| releaseNotes += `</dependency>\n\`\`\`\n\n`; | ||
|
|
||
| releaseNotes += `**Gradle**:\n\`\`\`gradle\n`; | ||
| releaseNotes += `implementation 'io.github.a2asdk:a2a-java-sdk-client:${version}'\n`; | ||
| releaseNotes += `\`\`\`\n\n`; | ||
|
|
||
| // Add links | ||
| releaseNotes += `### Links\n\n`; | ||
| releaseNotes += `- [Maven Central](https://central.sonatype.com/artifact/io.github.a2asdk/a2a-java-sdk-parent/${version})\n`; | ||
| releaseNotes += `- [JavaDoc](https://javadoc.io/doc/io.github.a2asdk/a2a-java-sdk-parent/${version})\n`; | ||
| releaseNotes += `- [GitHub](https://github.com/a2aproject/a2a-java/tree/v${version})\n\n`; | ||
|
|
||
| // Add changelog header | ||
| if (previousTag) { | ||
| releaseNotes += `### Changes since ${previousTag}\n\n`; | ||
| releaseNotes += `[Full Changelog](https://github.com/a2aproject/a2a-java/compare/${previousTag}...v${version})\n\n`; | ||
| } else { | ||
| releaseNotes += `### Changes\n\n`; | ||
| } | ||
|
|
||
| return releaseNotes; | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const version = '${{ steps.version.outputs.version }}'; | ||
| const tag = context.ref.replace('refs/tags/', ''); | ||
| const releaseNotes = ${{ steps.release_notes.outputs.result }}; | ||
|
|
||
| // Determine if this is a pre-release | ||
| const isPrerelease = version.includes('Alpha') || | ||
| version.includes('Beta') || | ||
| version.includes('RC') || | ||
| version.includes('SNAPSHOT'); | ||
|
|
||
| try { | ||
| const { data: release } = await github.rest.repos.createRelease({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| tag_name: tag, | ||
| name: `v${version}`, | ||
| body: releaseNotes, | ||
| draft: false, | ||
| prerelease: isPrerelease, | ||
| generate_release_notes: true // GitHub will append auto-generated notes | ||
| }); | ||
|
|
||
| console.log(`✅ Created release: ${release.html_url}`); | ||
| core.summary | ||
| .addHeading(`Release v${version} Created`) | ||
| .addLink('View Release', release.html_url) | ||
| .addLink('Maven Central', `https://central.sonatype.com/artifact/io.github.a2asdk/a2a-java-sdk-parent/${version}`) | ||
| .write(); | ||
|
|
||
| } catch (error) { | ||
| if (error.status === 422 && error.message.includes('already_exists')) { | ||
| console.log('⚠️ Release already exists for this tag'); | ||
| } else { | ||
| throw error; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The current version parsing logic is a bit fragile. If a line ends with a colon or has only whitespace after it,
tokenize()[0]will throw anArrayIndexOutOfBoundsException, causing the build to fail with a potentially unclear stack trace. A more robust approach would handle this case gracefully and provide a more informative error message.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.
@gemini-code-assist this was your idea. Come up with a final solution. We should be able to extract the version no matter what!
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.
You're right,
tokenize()can be a bit too broad if there are non-whitespace characters immediately following the version that aren't part of the version string itself (e.g., a comma or another delimiter). To make the version extraction truly robust and handle cases like//DEPS io.github.a2asdk:artifact-id:1.0.0, some-other-infoor//DEPS io.github.a2asdk:artifact-id:1.0.0-SNAPSHOT//comment, a regular expression is a more precise tool.This updated suggestion uses a regex to explicitly capture the version string, which typically consists of alphanumeric characters, dots, and hyphens, from the beginning of the trimmed string after the last colon. It also retains the graceful handling of missing versions by printing
<missing>.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.
OTOH we don't have that many JBang scripts - we should just not write confusing DEPS