-
Notifications
You must be signed in to change notification settings - Fork 539
feat: julia release type with registration included #2713
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
MilesCranmer
wants to merge
8
commits into
googleapis:main
Choose a base branch
from
MilesCranmerBot:feat/julia-release-type
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
8 commits
Select commit
Hold shift + click to select a range
ba340bb
feat: add julia release type
MilesCranmerBot 728d435
feat: auto-register julia releases
MilesCranmerBot 6e25d68
test: add github snapshot for julia registration
MilesCranmerBot b8dfc09
fix: restore github snapshots
MilesCranmerBot 503c083
fix: tighten julia error handling and refresh cli snapshots
MilesCranmerBot 5f59858
docs: add julia release type to docs
MilesCranmerBot 911ad18
feat: support JuliaProject.toml and Registrator release notes
MilesCranmerBot e9d00a9
chore: correct julia license header years
MilesCranmerBot 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
| exports['Julia buildReleasePullRequest detects the default component from Project.toml 1'] = ` | ||
| :robot: I have created a release *beep* *boop* | ||
| --- | ||
|
|
||
|
|
||
| ## [0.4.0](https://github.com/googleapis/julia-test-repo/compare/ExampleJuliaPkg-v0.3.4...ExampleJuliaPkg-v0.4.0) (1983-10-10) | ||
|
|
||
|
|
||
| ### Features | ||
|
|
||
| * add symbolic thing ([d865831](https://github.com/googleapis/julia-test-repo/commit/d8658312b54b022f965211ba28fe4a55)) | ||
|
|
||
|
|
||
| ### Bug Fixes | ||
|
|
||
| * patch symbolic thing ([2972ce7](https://github.com/googleapis/julia-test-repo/commit/2972ce71f204d4b66b45a78bb5585eaa)) | ||
|
|
||
| --- | ||
| This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). | ||
| ` |
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
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
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
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
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,102 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import {BaseStrategy, BuildUpdatesOptions} from './base'; | ||
| import {FileNotFoundError} from '../errors'; | ||
| import {Update} from '../update'; | ||
| import {Changelog} from '../updaters/changelog'; | ||
| import {Version} from '../version'; | ||
| import { | ||
| ProjectToml, | ||
| parseProjectToml, | ||
| JuliaProject, | ||
| } from '../updaters/julia/project-toml'; | ||
|
|
||
| interface ProjectTomlInfo { | ||
| path: string; | ||
| project: JuliaProject; | ||
| } | ||
|
|
||
| export class Julia extends BaseStrategy { | ||
| private projectTomlInfo?: ProjectTomlInfo | null; | ||
|
|
||
| protected async buildUpdates( | ||
| options: BuildUpdatesOptions | ||
| ): Promise<Update[]> { | ||
| const updates: Update[] = []; | ||
| const version = options.newVersion; | ||
|
|
||
| if (!this.skipChangelog) { | ||
| updates.push({ | ||
| path: this.addPath(this.changelogPath), | ||
| createIfMissing: true, | ||
| updater: new Changelog({ | ||
| version, | ||
| changelogEntry: options.changelogEntry, | ||
| }), | ||
| }); | ||
| } | ||
|
|
||
| updates.push({ | ||
| path: await this.getProjectTomlPath(), | ||
| createIfMissing: false, | ||
| updater: new ProjectToml({version}), | ||
| }); | ||
|
|
||
| return updates; | ||
| } | ||
|
|
||
| protected initialReleaseVersion(): Version { | ||
| return Version.parse('0.1.0'); | ||
| } | ||
|
|
||
| async getDefaultPackageName(): Promise<string | undefined> { | ||
| const projectTomlInfo = await this.getProjectTomlInfo(); | ||
| return projectTomlInfo?.project.name; | ||
| } | ||
|
|
||
| private async getProjectTomlPath(): Promise<string> { | ||
| const projectTomlInfo = await this.getProjectTomlInfo(); | ||
| return projectTomlInfo?.path ?? this.addPath('Project.toml'); | ||
| } | ||
|
|
||
| private async getProjectTomlInfo(): Promise<ProjectTomlInfo | null> { | ||
| if (this.projectTomlInfo === undefined) { | ||
| this.projectTomlInfo = await this.loadProjectTomlInfo(); | ||
| } | ||
| return this.projectTomlInfo; | ||
| } | ||
|
|
||
| private async loadProjectTomlInfo(): Promise<ProjectTomlInfo | null> { | ||
| for (const filename of ['Project.toml', 'JuliaProject.toml']) { | ||
| try { | ||
| const path = this.addPath(filename); | ||
| const content = await this.github.getFileContentsOnBranch( | ||
| path, | ||
| this.targetBranch | ||
| ); | ||
| return { | ||
| path, | ||
| project: parseProjectToml(content.parsedContent), | ||
| }; | ||
| } catch (e) { | ||
| if (e instanceof FileNotFoundError) { | ||
| continue; | ||
| } | ||
| throw e; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } |
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,43 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import * as TOML from '@iarna/toml'; | ||
| import {replaceTomlValue} from '../../util/toml-edit'; | ||
| import {DefaultUpdater} from '../default'; | ||
|
|
||
| export interface JuliaProject { | ||
| name?: string; | ||
| version?: string; | ||
| } | ||
|
|
||
| export function parseProjectToml(content: string): JuliaProject { | ||
| const parsed = TOML.parse(content) as Record<string, unknown>; | ||
| return { | ||
| name: typeof parsed.name === 'string' ? parsed.name : undefined, | ||
| version: typeof parsed.version === 'string' ? parsed.version : undefined, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Updates Julia `Project.toml` manifests while preserving formatting/comments. | ||
| */ | ||
| export class ProjectToml extends DefaultUpdater { | ||
| updateContent(content: string): string { | ||
| const parsed = parseProjectToml(content); | ||
| if (!parsed.version) { | ||
| throw new Error('Project.toml does not contain a version field'); | ||
| } | ||
| return replaceTomlValue(content, ['version'], this.version.toString()); | ||
| } | ||
| } |
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,6 @@ | ||
| name = "ExampleJuliaPkg" | ||
| uuid = "12345678-1234-1234-1234-123456789abc" | ||
| version = "0.3.4" | ||
|
|
||
| [compat] | ||
| julia = "1.10" |
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
Oops, something went wrong.
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.
Can we separate out this extra logic from the Julia strategy and file updates?
Everything in manifest.ts should be strategy/language-agnostic so it doesn't feel right having special logic for Julia here