Skip to content

Commit

Permalink
发版时自动上传到腾讯云对象存储 (#874)
Browse files Browse the repository at this point in the history
* 发版时自动上传到腾讯云对象存储

* 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 仓库变量
  • Loading branch information
jingjingxyk authored Dec 30, 2024
1 parent cb640bb commit b9a7cc7
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 161 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/artifact-hash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ on:
version:
required: true
description: "发版 版本号 tag"
default: 'v5.1.6.0'
default: 'v6.0.0.0'
type: string
enable_upload_cloud_object_storage:
required: false
type: boolean
description: "上传到云对象存储 (默认不需要上传)"

jobs:
generate-artifact-hash:
Expand All @@ -25,3 +29,14 @@ jobs:
retention-days: 90
path: |
${{ inputs.version }}-sha256sum
- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (inputs.enable_upload_cloud_object_storage == true) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-all --swoole-cli-version ${{ inputs.version }}
5 changes: 2 additions & 3 deletions .github/workflows/auto-cache-pool-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
key: source-code-tarball-pool

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

Expand Down Expand Up @@ -100,7 +100,6 @@ jobs:
ls -A pool/ext/
- name: production artifacts
if: 1
uses: actions/upload-artifact@v4
with:
name: all-deps
Expand All @@ -111,7 +110,7 @@ jobs:
- name: gh release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: |
all-deps.zip
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz

- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz
10 changes: 10 additions & 0 deletions .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz

- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz
10 changes: 10 additions & 0 deletions .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-macos-arm64.tar.xz

- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-arm64.tar.xz
10 changes: 10 additions & 0 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz

- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz
26 changes: 23 additions & 3 deletions .github/workflows/windows-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ jobs:
run: |
ls -lah /cygdrive/c/
ls -lah /cygdrive/d/
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
bash ./sapi/scripts/cygwin/install-cygwin.sh
- name: Install Cygwin Packages
Expand Down Expand Up @@ -135,8 +133,30 @@ jobs:

- name: gh release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip

upload-to-cloud-object-storage:
if: 1
runs-on: ubuntu-latest
needs: windows-cygwin
steps:
- name: Prepare Run Environment
run:
sudo apt install -y curl
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: upload artifacts to cloud object storage
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
FILE_NAME=$(ls -d swoole-cli-v*-cygwin-x64)
FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip"
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${FILE}
Loading

0 comments on commit b9a7cc7

Please sign in to comment.