Skip to content

Commit

Permalink
Merge pull request futrime#149 from ShrBox/main
Browse files Browse the repository at this point in the history
feat: add version variable support for asset_url futrime#134
  • Loading branch information
ShrBox authored Jul 13, 2024
2 parents 0c45a71 + 99e1f80 commit 4054537
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.23.0] - 2024-07-12

### Added

- Add version variable support for asset_url [#134]

### Fixed

- Fix `.lip` path in linux [#129]
- Fix unable to decompress .tar.gz [#140]
- Delete surplus tabs (#139)

## [0.22.0] - 2024-03-23

### Added
Expand Down Expand Up @@ -422,7 +434,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Basic functions: cache, install, list, show, tooth init, and uninstall.

[Unreleased]: https://github.com/lippkg/lip/compare/v0.21.2...HEAD
[#129]: https://github.com/lippkg/lip/issues/129
[#134]: https://github.com/lippkg/lip/issues/134
[#140]: https://github.com/lippkg/lip/issues/140

[Unreleased]: https://github.com/lippkg/lip/compare/v0.23.0...HEAD
[0.23.0]: https://github.com/lippkg/lip/compare/v0.22.0...v0.23.0
[0.22.0]: https://github.com/lippkg/lip/compare/v0.21.2...v0.22.0
[0.21.2]: https://github.com/lippkg/lip/compare/v0.21.1...v0.21.2
[0.21.1]: https://github.com/lippkg/lip/compare/v0.21.0...v0.21.1
Expand Down
2 changes: 1 addition & 1 deletion cmd/lip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var defaultConfig context.Config = context.Config{
ProxyURL: "",
}

var lipVersion semver.Version = semver.MustParse("0.22.0")
var lipVersion semver.Version = semver.MustParse("0.23.0")

func main() {
if os.Getenv("NO_COLOR") != "" {
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/tooth_json_file_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ Declares the URL of the tooth asset. If this field is set, lip will download the

### Syntax

The URL should be a direct link to the asset file. The asset file should be a zip archive file.
The URL should be a direct link to the asset file or Go Module URL. The asset file should be a zip archive file.
In lip 0.23.0 and above, you can use `$(version)` to refer to the `version` field above.

### Examples

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/tooth_json_file_reference.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ tooth路径必须唯一地标识您的tooth。对于大多数tooth,路径是

### 语法

URL应该是指向资产文件的直接链接。资产文件应该是一个zip归档文件。
URL应该是指向资产文件的直接链接或Go Module URL。资产文件应该是一个zip归档文件。
在lip 0.23.0及以上的版本中,你可以使用`$(version)`来引用上文中的`version`字段

### 示例

Expand Down
8 changes: 8 additions & 0 deletions internal/tooth/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ func MakeArchive(archiveFilePath path.Path) (Archive, error) {
return Archive{}, fmt.Errorf("failed to parse tooth.json\n\t%w", err)
}

// Replace ${version} with metadata version in AssetURL

if metadata.rawMetadata.AssetURL != "" {
if strings.Contains(metadata.rawMetadata.AssetURL, "$(version)") {
metadata.rawMetadata.AssetURL = strings.ReplaceAll(metadata.rawMetadata.AssetURL, "$(version)", metadata.rawMetadata.Version)
}
}

// Convert to platform-specific metadata.
metadata, err = metadata.ToPlatformSpecific(runtime.GOOS, runtime.GOARCH)
if err != nil {
Expand Down

0 comments on commit 4054537

Please sign in to comment.