{"id":21418960,"url":"https://github.com/hal-wang/filedeploy","last_synced_at":"2026-01-03T00:50:02.613Z","repository":{"id":236612821,"uuid":"739226494","full_name":"hal-wang/FileDeploy","owner":"hal-wang","description":"Deploy files to server and execute commands on server.","archived":false,"fork":false,"pushed_at":"2024-09-06T05:43:14.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T06:13:19.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hal-wang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-05T04:11:50.000Z","updated_at":"2024-09-06T05:43:17.000Z","dependencies_parsed_at":"2024-04-28T03:15:15.494Z","dependency_job_id":"f62a8b2a-c35b-4500-97a5-32958e7709c9","html_url":"https://github.com/hal-wang/FileDeploy","commit_stats":null,"previous_names":["hal-wang/filedeploy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2FFileDeploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2FFileDeploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2FFileDeploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2FFileDeploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hal-wang","download_url":"https://codeload.github.com/hal-wang/FileDeploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918874,"owners_count":20368786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T19:30:58.047Z","updated_at":"2026-01-03T00:50:02.563Z","avatar_url":"https://github.com/hal-wang.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# FileDeploy\n\n- Deploy files to server with WebApi\n- Execute commands on server with WebApi\n- Support for DevOps\n\n## Supported systems\n\n- Windows / Windows Server\n- Linux\n- MacOS\n\n## Params\n\n- ApiKey: Header variable, for verify identity\n- path: Form data, where the file save\n- preCommand: Form data, execute command before save file\n- postCommand: Form data, execute command after save file\n- \\\u003cfilePath\\\u003e: Form data, the key is file relative path, the value is file data. Allow multiple.\n\n## Examples\n\n### 1. Deploy dist dir\n\n```sh\nset -e\n\napiKey=$1\napiUrl=\"http://127.0.0.1:8081\"\ndir=\"./dist\"\n\nif [ -z \"$1\" ]; then\n  echo \"no apiKey!\"\n  exit 1\nfi\n\nfunction send_file() {\n  echo \"PUT file: \"$dir\"/\"$1\n\n  status=$(\n    curl \\\n      -s \\\n      -X PUT \\\n      -H 'Content-Type:multipart/form-data;charset=utf-8' \\\n      -H \"ApiKey:${apiKey}\" \\\n      -F \"path=C:/Web/TestWeb\" \\\n      -F \"$1=@${dir}/$1\" \\\n      -w \"%{http_code}\" \\\n      --connect-timeout 240 \\\n      --keepalive-time 240 \\\n      --retry 50 \\\n      --retry-max-time 0 \\\n      --retry-all-errors \\\n      --compressed \\\n      $apiUrl\n  )\n\n  if [ $status -ne 204 ]; then\n    echo \"Request failed, status = ${status}, file = $1\"\n    exit 1\n  fi\n}\n\nfunction read_dir() {\n  [[ $1 = \"\" ]] \u0026\u0026 dirPath=$dir || dirPath=\"$dir/$1\"\n  for file in $(ls $dirPath); do\n    [[ $1 = \"\" ]] \u0026\u0026 filePath=$file || filePath=\"$1/$file\"\n    if [ -d $dir\"/\"$filePath ]; then\n      read_dir $filePath\n    else\n      send_file $filePath\n    fi\n  done\n}\n\nread_dir \"\"\n\necho \"success\"\n```\n\n### 2. Stop Website before deploying dir and Run Website after deploying\n\n```sh\nset -e\n\napiKey=$1\napiUrl=\"http://127.0.0.1:8081\"\ntaskName=SCHEDULE_TASK_NAME\ndir=\"./publish\"\n\nif [ -z \"$1\" ]; then\n  echo \"no apiKey!\"\n  exit 1\nfi\n\nfunction send_file() {\n  echo \"PUT file: \"$dir\"/\"$1\n\n  status=$(\n    curl \\\n      -s \\\n      -X PUT \\\n      -H 'Content-Type:multipart/form-data;charset=utf-8' \\\n      -H \"ApiKey:${apiKey}\" \\\n      -F \"path=C:/Web/TestWeb\" \\\n      -F \"$1=@${dir}/$1\" \\\n      -w \"%{http_code}\" \\\n      --connect-timeout 240 \\\n      --keepalive-time 240 \\\n      --retry 50 \\\n      --retry-max-time 0 \\\n      --retry-all-errors \\\n      --compressed \\\n      $apiUrl\n  )\n\n  if [ $status -ne 204 ]; then\n    echo \"Request failed, status = ${status}, file = $1\"\n    exit 1\n  fi\n}\n\nfunction exec_command() {\n  echo \"EXEC command: $1\"\n\n  status=$(\n    curl \\\n      -s \\\n      -X PUT \\\n      -H 'Content-Type:multipart/form-data;charset=utf-8' \\\n      -H \"ApiKey:${apiKey}\" \\\n      -F \"path=C:/Web/TestWeb\" \\\n      -F \"preCommand=\\\"$1\\\"\" \\\n      -w \"%{http_code}\" \\\n      --connect-timeout 240 \\\n      --keepalive-time 240 \\\n      --retry 50 \\\n      --retry-max-time 0 \\\n      --retry-all-errors \\\n      --compressed \\\n      $apiUrl\n  )\n\n  if [ $status -ne 204 ]; then\n    echo \"Request failed, status = ${status}, file = $1\"\n    exit 1\n  fi\n}\n\nfunction read_dir() {\n  [[ $1 = \"\" ]] \u0026\u0026 dirPath=$dir || dirPath=\"$dir/$1\"\n  for file in $(ls $dirPath); do\n    [[ $1 = \"\" ]] \u0026\u0026 filePath=$file || filePath=\"$1/$file\"\n    if [ -d $dir\"/\"$filePath ]; then\n      read_dir $filePath\n    else\n      send_file $filePath $file\n    fi\n  done\n}\n\nexec_command \"schtasks /end /tn $taskName\n  schtasks /change /tn $taskName /disable\"\nread_dir \"\"\nexec_command \"schtasks /change /tn $taskName /enable\n  schtasks /run /tn $taskName\"\n\necho \"success\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-wang%2Ffiledeploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhal-wang%2Ffiledeploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-wang%2Ffiledeploy/lists"}