From f3b8b6a3b1ed504eb5fda44d966da5607f2b5b0b Mon Sep 17 00:00:00 2001 From: CookSleep <151028412+CookSleep@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:23:58 +0800 Subject: [PATCH] Update macos-build.yml --- .github/workflows/macos-build.yml | 38 ++++++------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index f7b2f22..ef44d57 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -2,7 +2,7 @@ name: Build macOS App on: release: - types: [published, edited] + types: [created] workflow_dispatch: jobs: @@ -36,39 +36,15 @@ jobs: echo "Contents of current directory:" ls -l - - name: Get release information - id: get_release - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - let releaseId, uploadUrl; - if (context.payload.release) { - releaseId = context.payload.release.id; - uploadUrl = context.payload.release.upload_url; - } else { - const response = await github.rest.repos.getLatestRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - }); - releaseId = response.data.id; - uploadUrl = response.data.upload_url; - } - core.setOutput('upload_url', uploadUrl); - core.setOutput('release_id', releaseId); - - name: Debug run: | - echo "Upload URL: ${{ steps.get_release.outputs.upload_url }}" - echo "Release ID: ${{ steps.get_release.outputs.release_id }}" + echo "GITHUB_REF: ${{ github.ref }}" ls -l ./Project_Exporter-macOS.zip - - name: Upload to Release - uses: actions/upload-release-asset@v1 + - name: Upload Release Asset + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ./Project_Exporter-macOS.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: ./Project_Exporter-macOS.zip - asset_name: Project_Exporter-macOS.zip - asset_content_type: application/zip