From 9f37b87fe98474eac7c44a323f1ddbe05654a289 Mon Sep 17 00:00:00 2001 From: Soltus Date: Tue, 2 Apr 2024 09:19:15 +0800 Subject: [PATCH] test action --- .github/workflows/cd.yml | 83 ++++++++++++++++++++++++++-------------- app/package.json | 2 +- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index fa6d644f6c..7bb77421d0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -241,16 +241,25 @@ jobs: run: pnpm run ${{ matrix.config.electron_args }} working-directory: ${{ github.workspace }}/go/src/github.com/Hi-Windom/Sillot/app - - name: Upload Release - uses: actions/upload-release-asset@v1 + - name: Upload Release Asset via REST API + run: | + asset_name="Sillot-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }}" + asset_path="${{ github.workspace }}/go/src/github.com/Hi-Windom/Sillot/app/build/Sillot-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }}" + upload_url="{{ needs.create_release.outputs.upload_url }}" + # Calculate the asset size + asset_size=$(stat -c%s "$asset_path") + # Generate the POST URL with asset name + post_url="$upload_url?name=$asset_name" + # Send the POST request with asset data + curl \ + -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$asset_path" \ + -H "Content-Length: $asset_size" \ + "$post_url" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # 这里使用 bot - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: Sillot-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }} - asset_path: ${{ github.workspace }}/go/src/github.com/Hi-Windom/Sillot/app/build/Sillot-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }} - asset_content_type: application/octet-stream + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: zip WinPortable uses: thedoctor0/zip-release@0.7.1 @@ -262,17 +271,25 @@ jobs: exclusions: '*.git*' recursive_exclusions: 'LICENSES.chromium.html' - - name: Upload WinPortable to release - uses: actions/upload-release-asset@v1 - if: contains( matrix.config.goos, 'windows') + - name: Upload WinPortable to release via REST API + if: contains(matrix.config.goos, 'windows') + run: | + asset_name="Sillot-${{ needs.create_release.outputs.release_version }}-win_Portable_.zip" + asset_path="Sillot-${{ needs.create_release.outputs.release_version }}-win_Portable_.zip" + # Calculate the asset size + asset_size=$(stat -c%s "$asset_path") + # Generate the POST URL with asset name + post_url="${{ needs.create_release.outputs.upload_url }}?name=$asset_name" + # Send the POST request with asset data + curl \ + -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$asset_path" \ + -H "Content-Length: $asset_size" \ + "$post_url" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # 这里使用 bot - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: Sillot-${{ needs.create_release.outputs.release_version }}-win_Portable_.zip - asset_path: Sillot-${{ needs.create_release.outputs.release_version }}-win_Portable_.zip - asset_content_type: application/octet-stream + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Manual setup is required when the built-in version does not work correctly in windows2022 @@ -333,13 +350,23 @@ jobs: # override default build-tools version -- optional BUILD_TOOLS_VERSION: "34.0.0" - - name: Upload APK to release - uses: actions/upload-release-asset@v1 - if: contains( matrix.config.goos, 'windows') + - name: Upload APK to release via REST API + if: contains(matrix.config.goos, 'windows') + run: | + asset_name="Sillot-${{ needs.create_release.outputs.release_version }}-debug.apk" + asset_path="${{steps.sign_app.outputs.signedReleaseFile}}" + upload_url="{{ needs.create_release.outputs.upload_url }}" + # Calculate the asset size + asset_size=$(stat -c%s "$asset_path") + # Generate the POST URL with asset name + post_url="$upload_url?name=$asset_name" + # Send the POST request with asset data + curl \ + -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/vnd.android.package-archive" \ + --data-binary "@$asset_path" \ + -H "Content-Length: $asset_size" \ + "$post_url" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: Sillot-${{ needs.create_release.outputs.release_version }}-debug.apk - asset_path: ${{steps.sign_app.outputs.signedReleaseFile}} - asset_content_type: application/octet-stream + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/package.json b/app/package.json index 1091d0ce4b..bf1e224247 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "sillot", - "version": "0.28.8", + "version": "0.28.9", "syv": "3.0.6", "sypv": "3.0.5", "description": "Build Your Eternal Digital Garden",