{"id":28351206,"url":"https://github.com/wangsijie/static-deploy-tool","last_synced_at":"2025-10-25T17:10:07.790Z","repository":{"id":46866033,"uuid":"241403649","full_name":"wangsijie/static-deploy-tool","owner":"wangsijie","description":"一条命令自动部署文件夹或大文件到阿里云OSS","archived":false,"fork":false,"pushed_at":"2023-01-07T06:26:41.000Z","size":851,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T04:41:08.030Z","etag":null,"topics":["alibabacloud","aliyun","aliyun-oss","oss","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wangsijie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-18T15:58:30.000Z","updated_at":"2023-12-05T12:06:44.000Z","dependencies_parsed_at":"2023-02-06T14:01:35.175Z","dependency_job_id":null,"html_url":"https://github.com/wangsijie/static-deploy-tool","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":"0.13793103448275867","last_synced_commit":"43e8c66f8604c88e3e0f55ccc15cd991a5d2a1da"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wangsijie/static-deploy-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangsijie%2Fstatic-deploy-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangsijie%2Fstatic-deploy-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangsijie%2Fstatic-deploy-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangsijie%2Fstatic-deploy-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wangsijie","download_url":"https://codeload.github.com/wangsijie/static-deploy-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangsijie%2Fstatic-deploy-tool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261099573,"owners_count":23109575,"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":["alibabacloud","aliyun","aliyun-oss","oss","serverless"],"created_at":"2025-05-27T22:09:32.460Z","updated_at":"2025-10-25T17:10:07.785Z","avatar_url":"https://github.com/wangsijie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# static-deploy-tool\n\n静态文件部署工具，一条命令自动部署文件夹或大文件到阿里云OSS\n\n## 安装\n\n全局安装\n\n```\nnpm i -g static-deploy-tool\n```\n\n也可以直接使用npx，无需安装\n\n## 常用命令\n\n### 同步文件夹到远程\n\n```bash\nsync \u003clocal\u003e \u003cremote\u003e\n```\n\n同步本地build文件夹到远程Bucket: my-bucket下的production/home文件夹\n\n```bash\nstatic-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket\n```\n\n该命令会首先逐个上传本地文件到远程目录，并根据md5比对跳过已有文件。之后**删除**远程存在但本地没有的文件。\n\n如果包含`index.html`或`index.htm`文件，则这类文件会在最后被上传，确保所以资源上传完毕后再更新index\n\n### 上传大文件到远程\n\n```bash\nput \u003clocal\u003e \u003cremote\u003e\n```\n\n使用分片上传的方式，将本地build/code.tar.gz文件上传到远程\n\n```bash\nstatic-deploy-tool put build/code.tar.gz production/code.tar.gz -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket\n```\n\n将会展示上传进度百分比，并且对于错误的分片自动重试\n\n### 复制远程文件\n\n```bash\ncopy \u003csource\u003e \u003cdest\u003e\n```\n\n复制远程文件`platform/sandbox/latest.tar.gz`到`platform/production/latest.tar.gz`\n\n```bash\nstatic-deploy-tool copy platform/sandbox/latest.tar.gz platform/production/latest.tar.gz -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket\n```\n\n## 配置\n\n```bash\n$ node cli --help\nOptions:\n  -V, --version              output the version number\n  -k, --ak [ak]              Access Key Id\n  -s, --sk [sk]              Secret Access Key\n  -r, --region [region]      Region\n  -b, --bucket [bucket]      Bucket\n  -e, --endpoint [endpoint]  Optional, will override region setting\n  -h, --help                 output usage information\n```\n\n### 环境变量\n\n除了用参数，也可以用环境变量\n\n```\nOSS_AK 等同于 --ak\nOSS_SK 等同于 --sk\nOSS_REGION 等同于 --region\nOSS_BUCKET 等同于 --bucket\nOSS_ENDPOINT 等同于 --endpoint\n```\n\n### 阿里云内网加速\n\n指定endpoint参数为内网地址\n\n```bash\nstatic-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket -e oss-cn-shanghai-internal.aliyuncs.com\n```\n\n### 全球加速\n\n用于GitHub Actions等国外服务传文件回国内有奇效，指定endpoint为oss-accelerate.aliyuncs.com\n\n**需要开通这个Bucket的全球加速功能**\n\n```bash\nstatic-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket -e oss-accelerate.aliyuncs.com\n```\n\n## 使用 Github Action\n\n```yaml\n- uses: wangsijie/static-deploy-tool@v1\n  with:\n    oss-ak: ${{ secrets.OSS_AK }}\n    oss-sk: ${{ secrets.OSS_SK }}\n    oss-region: ${{ secrets.OSS_REGION }}\n    oss-bucket: ${{ secrets.OSS_BUCKET }}\n    oss-endpoint: oss-accelerate.aliyuncs.com\n    local-path: __tests__/files\n    remote-path: static-deploy-tool-test/action-sync\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangsijie%2Fstatic-deploy-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwangsijie%2Fstatic-deploy-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangsijie%2Fstatic-deploy-tool/lists"}