Skip to content

Commit

Permalink
update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjj1024 committed Sep 22, 2024
1 parent 170c93a commit e25b613
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src-tauri/src/command/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ pub async fn read_json_file(handle: tauri::AppHandle) -> String {
}

#[tauri::command]
pub async fn update_build_file(handle: tauri::AppHandle, branch: String) -> String {
pub async fn update_build_file(handle: tauri::AppHandle) -> String {
let resource_path = handle
.path_resolver()
.resolve_resource("data/appbuild.yml")
.expect("failed to resolve resource");
let mut build_file = std::fs::File::open(&resource_path).unwrap();
let mut contents = String::new();
build_file.read_to_string(&mut contents).unwrap();
contents = contents.replace("PROJECTNAME", branch.as_str());
// contents = contents.replace("PROJECTNAME", branch.as_str());
// println!("Updated build file: {}", contents);
// The new file content, using Base64 encoding
let encoded_contents = BASE64_STANDARD.encode(contents);
Expand Down
6 changes: 2 additions & 4 deletions src/pages/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,14 @@ const updateBuildYml = async () => {
console.log('get build.yml file sha', shaRes)
if (shaRes.status === 200) {
// get build.yml file content
const content = await invoke('update_build_file', {
branch: branchName.value,
})
const content = await invoke('update_build_file')
console.log('content', content)
// update build.yml file content
const updateRes: any = await githubApi.updateBuildYmlFile(
store.userInfo.login,
'PakePlus',
{
message: 'update from pakeplus',
message: 'update build.yml from pakeplus',
content: content,
sha: shaRes.data.sha,
branch: branchName.value,
Expand Down

0 comments on commit e25b613

Please sign in to comment.