Skip to content

Commit b9a7cc7

Browse files
authored
发版时自动上传到腾讯云对象存储 (#874)
* 发版时自动上传到腾讯云对象存储 * optimize workflow upload file to cloud object storage * update * optimize upload cloud object storage * optimize upload to cloud object storage * optimize workflow if condition * update cygwin workflow config * update cygwin workflow config * download all-deps.zip version * update dowonload-cygwin.bat * merge main source code * merge main source code * 更新 获取 github respository 仓库变量 * 更新 获取 github respository 仓库变量
1 parent cb640bb commit b9a7cc7

12 files changed

+385
-161
lines changed

.github/workflows/artifact-hash.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ on:
66
version:
77
required: true
88
description: "发版 版本号 tag"
9-
default: 'v5.1.6.0'
9+
default: 'v6.0.0.0'
1010
type: string
11+
enable_upload_cloud_object_storage:
12+
required: false
13+
type: boolean
14+
description: "上传到云对象存储 (默认不需要上传)"
1115

1216
jobs:
1317
generate-artifact-hash:
@@ -25,3 +29,14 @@ jobs:
2529
retention-days: 90
2630
path: |
2731
${{ inputs.version }}-sha256sum
32+
33+
- name: upload artifacts to cloud object storage
34+
if: ${{ (github.repository == 'swoole/swoole-cli') && (inputs.enable_upload_cloud_object_storage == true) }}
35+
env:
36+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
37+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
38+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
39+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
40+
run: |
41+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-all --swoole-cli-version ${{ inputs.version }}
42+

.github/workflows/auto-cache-pool-tarball.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
key: source-code-tarball-pool
6262

6363
- name: Clean Source Code Tarball Cache On Release
64-
if: startsWith(github.ref, 'refs/tags/')
64+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
6565
run:
6666
rm -rf ${{ github.workspace }}/pool/*
6767

@@ -100,7 +100,6 @@ jobs:
100100
ls -A pool/ext/
101101
102102
- name: production artifacts
103-
if: 1
104103
uses: actions/upload-artifact@v4
105104
with:
106105
name: all-deps
@@ -111,7 +110,7 @@ jobs:
111110
112111
- name: gh release
113112
uses: softprops/action-gh-release@v2
114-
if: startsWith(github.ref, 'refs/tags/')
113+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
115114
with:
116115
files: |
117116
all-deps.zip

.github/workflows/linux-aarch64.yml

+10
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,13 @@ jobs:
183183
if: startsWith(github.ref, 'refs/tags/')
184184
with:
185185
files: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz
186+
187+
- name: upload artifacts to cloud object storage
188+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
189+
env:
190+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
191+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
192+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
193+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
194+
run: |
195+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz

.github/workflows/linux-x86_64.yml

+10
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,13 @@ jobs:
164164
if: startsWith(github.ref, 'refs/tags/')
165165
with:
166166
files: swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz
167+
168+
- name: upload artifacts to cloud object storage
169+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
170+
env:
171+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
172+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
173+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
174+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
175+
run: |
176+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz

.github/workflows/macos-aarch64.yml

+10
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,13 @@ jobs:
148148
if: startsWith(github.ref, 'refs/tags/')
149149
with:
150150
files: swoole-cli-v${{ env.APP_VERSION }}-macos-arm64.tar.xz
151+
152+
- name: upload artifacts to cloud object storage
153+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
154+
env:
155+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
156+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
157+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
158+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
159+
run: |
160+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-arm64.tar.xz

.github/workflows/macos-x86_64.yml

+10
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,13 @@ jobs:
148148
if: startsWith(github.ref, 'refs/tags/')
149149
with:
150150
files: swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz
151+
152+
- name: upload artifacts to cloud object storage
153+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
154+
env:
155+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
156+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
157+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
158+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
159+
run: |
160+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz

.github/workflows/windows-cygwin.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ jobs:
5959
run: |
6060
ls -lah /cygdrive/c/
6161
ls -lah /cygdrive/d/
62-
6362
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
64-
6563
bash ./sapi/scripts/cygwin/install-cygwin.sh
6664
6765
- name: Install Cygwin Packages
@@ -135,8 +133,30 @@ jobs:
135133

136134
- name: gh release
137135
uses: softprops/action-gh-release@v2
138-
if: startsWith(github.ref, 'refs/tags/')
136+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
139137
env:
140138
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141139
with:
142140
files: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip
141+
142+
upload-to-cloud-object-storage:
143+
if: 1
144+
runs-on: ubuntu-latest
145+
needs: windows-cygwin
146+
steps:
147+
- name: Prepare Run Environment
148+
run:
149+
sudo apt install -y curl
150+
- uses: actions/checkout@v4
151+
- uses: actions/download-artifact@v4
152+
- name: upload artifacts to cloud object storage
153+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
154+
env:
155+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
156+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
157+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
158+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
159+
run: |
160+
FILE_NAME=$(ls -d swoole-cli-v*-cygwin-x64)
161+
FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip"
162+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${FILE}

0 commit comments

Comments
 (0)