diff --git a/.github/workflows/move-major-tag.yml b/.github/workflows/move-major-tag.yml new file mode 100644 index 0000000..1b7a02e --- /dev/null +++ b/.github/workflows/move-major-tag.yml @@ -0,0 +1,24 @@ +name: Move v1 tag + +on: + push: + tags: + - 'v1.*' + +permissions: + contents: write + +jobs: + update-major-tag: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Move v1 tag + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + + git tag -f v1 + git push origin v1 --force \ No newline at end of file diff --git a/api/src/handlers/manifest.rs b/api/src/handlers/manifest.rs index c4ac01f..c1f7846 100644 --- a/api/src/handlers/manifest.rs +++ b/api/src/handlers/manifest.rs @@ -89,9 +89,7 @@ pub async fn get_manifest() -> impl IntoResponse { // Read metadata.json for this run if it exists let metadata: Option = std::fs::read_to_string( - report_path - .join(file_name) - .join("metadata.json"), + report_path.join(file_name).join("metadata.json"), ) .ok() .and_then(|s| serde_json::from_str(&s).ok()); diff --git a/api/src/services/report_service.rs b/api/src/services/report_service.rs index 73b0b16..419f2c1 100644 --- a/api/src/services/report_service.rs +++ b/api/src/services/report_service.rs @@ -218,12 +218,7 @@ pub async fn upload_report(mut multipart: Multipart) -> impl IntoResponse { "report_type": report_type, "created_at": created_at_unix }); - if let Err(e) = tokio::fs::write( - report_dir.join("metadata.json"), - metadata.to_string(), - ) - .await - { + if let Err(e) = tokio::fs::write(report_dir.join("metadata.json"), metadata.to_string()).await { eprintln!("Warning: Failed to write metadata.json: {}", e); } @@ -349,11 +344,12 @@ pub async fn upload_report(mut multipart: Multipart) -> impl IntoResponse { // Create/update 'latest' symlink pointing to this run's numeric ID let latest_link = parent_dir.join("latest"); - if tokio::fs::symlink_metadata(&latest_link).await.is_ok() { - if let Err(e) = tokio::fs::remove_file(&latest_link).await { - eprintln!("Warning: Failed to remove old 'latest' symlink: {}", e); - } + if tokio::fs::symlink_metadata(&latest_link).await.is_ok() + && let Err(e) = tokio::fs::remove_file(&latest_link).await + { + eprintln!("Warning: Failed to remove old 'latest' symlink: {}", e); } + if let Err(e) = tokio::fs::symlink(&report_id, &latest_link).await { eprintln!("Warning: Failed to create 'latest' symlink: {}", e); }