Skip to content

Commit

Permalink
Merge pull request #1 from bachue/main
Browse files Browse the repository at this point in the history
initial action
  • Loading branch information
carter2000 authored Apr 11, 2024
2 parents d3c25ae + 8dae5fc commit e36edd3
Show file tree
Hide file tree
Showing 16 changed files with 70,966 additions and 21 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"es2021": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {},
"overrides": [
{
"files": [
"tests/**/*"
],
"env": {
"jest": true
}
}
]
}
44 changes: 44 additions & 0 deletions .github/workflows/real-action-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Real Action Test
on: [push, pull_request]
jobs:
action-test:
strategy:
matrix:
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Prepare for tempdata
run: |
set -e
mkdir tempdata
mkdir tempdata/subdir1
mkdir tempdata/subdir2
dd if=/dev/urandom of=tempdata/1K bs=1K count=1
dd if=/dev/urandom of=tempdata/1M bs=1M count=1
dd if=/dev/urandom of=tempdata/2M bs=2M count=1
dd if=/dev/urandom of=tempdata/5M bs=5M count=1
dd if=/dev/urandom of=tempdata/10M bs=10M count=1
dd if=/dev/urandom of=tempdata/subdir1/1K bs=1K count=1
dd if=/dev/urandom of=tempdata/subdir1/1M bs=1M count=1
dd if=/dev/urandom of=tempdata/subdir1/2M bs=2M count=1
dd if=/dev/urandom of=tempdata/subdir1/5M bs=5M count=1
dd if=/dev/urandom of=tempdata/subdir1/10M bs=10M count=1
dd if=/dev/urandom of=tempdata/subdir2/1K bs=1K count=1
dd if=/dev/urandom of=tempdata/subdir2/1M bs=1M count=1
dd if=/dev/urandom of=tempdata/subdir2/2M bs=2M count=1
dd if=/dev/urandom of=tempdata/subdir2/5M bs=5M count=1
dd if=/dev/urandom of=tempdata/subdir2/10M bs=10M count=1
shell: bash
- name: Run action
uses: ./
with:
bucket: "${{ secrets.QINIU_BUCKET }}"
access_key: "${{ secrets.QINIU_ACCESS_KEY }}"
secret_key: "${{ secrets.QINIU_SECRET_KEY }}"
prefix: "${{ secrets.QINIU_BUCKET_PREFIX }}action-${{ matrix.os }}/"
file_type: 4
concurrency: 10
artifacts: |
tempdata/**/*
!tempdata/**/1K
23 changes: 23 additions & 0 deletions .github/workflows/simple-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Simple Upload Test
on: [push, pull_request]
jobs:
upload-test:
strategy:
matrix:
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup dependencies
run: npm install
- name: Run checks
run: npm run check-all
env:
QINIU_ACCESS_KEY: "${{ secrets.QINIU_ACCESS_KEY }}"
QINIU_SECRET_KEY: "${{ secrets.QINIU_SECRET_KEY }}"
QINIU_BUCKET: "${{ secrets.QINIU_BUCKET }}"
QINIU_BUCKET_PREFIX: "${{ secrets.QINIU_BUCKET_PREFIX }}${{ matrix.os }}/"
146 changes: 125 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,125 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist/src/
dist/tests/
dist/jest.config.js

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
60 changes: 60 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Upload Qiniu Artifacts
description: 'An Github action could help to upload artifacts to qiniu'
author: Qiniu
inputs:
bucket:
description: 'Qiniu bucket name'
required: true
type: string
access_key:
description: 'Qiniu access key'
required: true
type: string
secret_key:
description: 'Qiniu secret key'
required: true
type: string
prefix:
description: 'Remote path prefix'
default: ''
type: string
file_type:
description: 'Qiniu file type'
default: 0
type: number
overwrite:
description: >
If true, an artifact will overwrite artifacts with the same name.
If false, the action will fail if an artifact for the given name already exists.
Does not fail if the artifact does not exist.
default: true
type: boolean
concurrency:
description: 'Number of concurrent file uploads'
default: 10
type: number
multipart_upload_part_size:
description: 'Size of each part of a multipart upload'
default: 4194304
type: number
multipart_upload_threshold:
description: 'Minimum size of a file before it is uploaded via multipart upload'
default: 4194304
type: number
bucket_hosts:
description: 'Qiniu bucket service hosts'
type: string
upload_hosts:
description: 'Qiniu upload service hosts'
type: string
use_insecure_protocol:
description: 'Use HTTP protocol'
default: false
type: boolean
artifacts:
description: 'Files glob to archive'
required: 'true'
type: string
runs:
using: 'node20'
main: 'dist/index.js'
Loading

0 comments on commit e36edd3

Please sign in to comment.