https://github.com/menci/upload-to-oss
GitHub Actions to sync files in a directory to Aliyun OSS with a prefix incrementally, with filename filter.
https://github.com/menci/upload-to-oss
Last synced: about 1 year ago
JSON representation
GitHub Actions to sync files in a directory to Aliyun OSS with a prefix incrementally, with filename filter.
- Host: GitHub
- URL: https://github.com/menci/upload-to-oss
- Owner: Menci
- Created: 2022-01-04T06:56:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-05T18:27:34.000Z (over 3 years ago)
- Last Synced: 2025-04-18T15:17:25.614Z (over 1 year ago)
- Language: TypeScript
- Size: 44.9 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitHub Action for upload files to Aliyun OSS
Upload files in a directory to Aliyun OSS with a prefix incrementally, with filename filter.
Incremental upload is implemented by comparing local MD5 and remote `eTag` (`eTag` = MD5 when uploaded with `PutObject`).
# Usage
```yaml
jobs:
build-and-deploy:
name: Build and Deploy website to OSS
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
# ... build your static website
- uses: Menci/upload-to-oss@beta-v1
with:
# Use Access Key
access-key-id: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
# Or use STS Token
# security-token: ${{ secrets.ALIYUN_SECURITY_TOKEN }}
bucket: ${{ secrets.ALIYUN_OSS_BUCKET }}
endpoint: ${{ secrets.ALIYUN_OSS_ENDPOINT }}
# Upload the built website files in "dist" directory to remote "my-website/" prefix
local-path: dist
remote-path: my-website
# Include HTML files only
include-regex: \.html$
# Exclude some files
excluce-regex: dont-upload-this\.html$
# Set some headers (JS function or just in JSON)
headers: |
filename => (
{
"Cache-Control": `public, max-age=${filename.endsWith(".html") ? 60 : 604800}`
}
)
# Upload ALL other files before uploading HTML files
delay-html-file-upload: true
# Prevent deleting missing remote files compared to local (defaults to `false`)
no-delete-remote-files: true
# Retry 5 times on failure of each OSS operation
retry: 5
# Use increment or not
increment: true
```