-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
111 lines (101 loc) · 3.39 KB
/
action.yml
File metadata and controls
111 lines (101 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: "Sync2OSS"
description: "Sync files to Aliyun OSS with .NET 9"
author: "XingSora"
branding:
icon: upload-cloud
color: white
inputs:
accessKeyId:
description: "Aliyun AccessKeyId"
required: true
accessKeySecret:
description: "Aliyun AccessKeySecret"
required: true
endpoint:
description: "Aliyun Endpoint"
required: true
bucketName:
description: "Aliyun BucketName"
required: true
fromRelease:
description: "是否从Release上传"
default: true
repoUrl:
description: "GitHub仓库地址"
required: false
isPre:
description: "是否上传PreRelease"
default: false
keepCount:
description: "保留最新几个版本"
default: "2"
remoteDir:
description: "上传到远程目录"
required: false
addSymlink:
description: "是否添加软链接"
default: false
localPath:
description: "本地文件/文件夹路径(fromRelease为false时使用)"
required: false
region:
description: "阿里云OSS区域"
default: "cn-shanghai"
runs:
using: "composite"
steps:
- name: Checkout Sync2Oss Repository
uses: actions/checkout@v4
with:
path: sync2oss_workspace
repository: xcube-studio/sync2oss
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Build Sync2OSS
shell: bash
run: |
PROJECT_DIR="${{ github.workspace }}/sync2oss_workspace/src"
echo "Restoring dependencies..."
dotnet restore "$PROJECT_DIR"
echo "Building project..."
dotnet build "$PROJECT_DIR" -c Release -o "$PROJECT_DIR/build" --nologo
#echo "Publishing project..."
#dotnet publish "$PROJECT_DIR" -c Release -o "$PROJECT_DIR/publish" --nologo
- name: Run Sync2OSS (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
"%GITHUB_WORKSPACE%\sync2oss_workspace\src\build\sync2oss.exe" ^
--accessKeyId "${{ inputs.accessKeyId }}" ^
--accessKeySecret "${{ inputs.accessKeySecret }}" ^
--endpoint "${{ inputs.endpoint }}" ^
--bucketName "${{ inputs.bucketName }}" ^
--fromRelease "${{ inputs.fromRelease }}" ^
--isPre "${{ inputs.isPre }}" ^
--keepCount "${{ inputs.keepCount }}" ^
--region "${{ inputs.region }}" ^
--addSymlink "${{ inputs.addSymlink }}" ^
--repoUrl "${{ inputs.repoUrl }}" ^
--remoteDir "${{ inputs.remoteDir }}" ^
--localPath "${{ inputs.localPath }}"
- name: Run Sync2OSS (Linux/macOS)
if: runner.os != 'Windows'
shell: sh
run: |
EXE_PATH="${{ github.workspace }}/sync2oss_workspace/src/build/sync2oss"
chmod +x "$EXE_PATH"
"$EXE_PATH" \
--accessKeyId "${{ inputs.accessKeyId }}" \
--accessKeySecret "${{ inputs.accessKeySecret }}" \
--endpoint "${{ inputs.endpoint }}" \
--bucketName "${{ inputs.bucketName }}" \
--fromRelease "${{ inputs.fromRelease }}" \
--isPre "${{ inputs.isPre }}" \
--keepCount "${{ inputs.keepCount }}" \
--region "${{ inputs.region }}" \
--addSymlink "${{ inputs.addSymlink }}" \
${{ inputs.repoUrl && format('--repoUrl "{0}"', inputs.repoUrl) }} \
${{ inputs.remoteDir && format('--remoteDir "{0}"', inputs.remoteDir) }} \
${{ inputs.localPath && format('--localPath "{0}"', inputs.localPath) }}