Skip to content
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

Standardize version string handling by replacing 'v' prefix in auto update #226

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/amber/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function autoUpdate() {
const src = std.file(std.indoc`
let version = http get https://api.github.com/repos/amber-lang/amber/releases/latest
| get tag_name
| str replace --regex '^v' ''

$env.project | from json | update version $version | to json
`);
Expand Down
2 changes: 1 addition & 1 deletion packages/bat/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function autoUpdate() {
const src = std.file(std.indoc`
let version = http get https://api.github.com/repos/sharkdp/bat/releases/latest
| get tag_name
| str substring 1..
| str replace --regex '^v' ''

$env.project | from json | update version $version | to json
`);
Expand Down
2 changes: 1 addition & 1 deletion packages/broot/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function autoUpdate() {
const src = std.file(std.indoc`
let version = http get https://api.github.com/repos/Canop/broot/releases/latest
| get tag_name
| str substring 1..
| str replace --regex '^v' ''

$env.project | from json | update version $version | to json
`);
Expand Down
3 changes: 1 addition & 2 deletions packages/github_cli/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function autoUpdate() {

let version = $releaseData
| get tag_name
| str replace '^v' ''
| str replace --regex '^v' ''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asheliahut I had to adjust the argument here to properly use the regex capabilities of str replace. Otherwise it was just doing a raw find and replace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a way to take this stuff for GitHub and make it generic so we put in the repo name, and get back this part of this and a path for any replacement for things in version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylewlacy began to expose possible solutions here: #176 to hide this work into a dedicated function that could be static or not (depending of the option chosen).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, Yeah I am not saying this needs to be done here. I am good with accepting. Sorry I have been really focused on work lately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry, same on my side, I'm juggling with my work too.


let latestBuildDate = $releaseData
| get created_at
Expand All @@ -63,7 +63,6 @@ export function autoUpdate() {
| update version $version
| update latestBuildDate $latestBuildDate
| to json

`);

return std.withRunnable(std.directory(), {
Expand Down
1 change: 1 addition & 0 deletions packages/libpsl/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function autoUpdate() {
const src = std.file(std.indoc`
let version = http get https://api.github.com/repos/rockdaboot/libpsl/releases/latest
| get tag_name
| str replace --regex '^v' ''

$env.project | from json | update version $version | to json
`);
Expand Down
1 change: 1 addition & 0 deletions packages/seaweedfs/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function autoUpdate() {
const src = std.file(std.indoc`
let version = http get https://api.github.com/repos/seaweedfs/seaweedfs/releases/latest
| get tag_name
| str replace --regex '^v' ''

$env.project | from json | update version $version | to json
`);
Expand Down