From 58d19b83c172f320f0c96879206d0ab29fdb60aa Mon Sep 17 00:00:00 2001 From: SwartzMss Date: Thu, 22 May 2025 22:53:35 +0800 Subject: [PATCH] upload release --- .github/workflows/release.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c940b1..b72dd5a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,3 +58,37 @@ jobs: name: MeetingAssistant path: release.zip retention-days: 30 + + - name: Get existing Release upload URL + id: get_release + uses: actions/github-script@v6 + with: + script: | + const tag = context.ref.startsWith("refs/tags/") ? context.ref.substring("refs/tags/".length) : context.ref; + core.info(`Using tag: ${tag}`); + const release = await github.rest.repos.getReleaseByTag({ + owner: context.repo.owner, + repo: context.repo.repo, + tag: tag + }); + const uploadUrl = release.data.upload_url; // 不要去掉 {?name,label} + core.info(`Found release with upload_url: ${uploadUrl}`); + return uploadUrl; + + - name: Debug GITHUB_TOKEN + shell: powershell + run: | + if ($env:GITHUB_TOKEN) { + Write-Host "GITHUB_TOKEN is defined." + } else { + Write-Host "GITHUB_TOKEN is NOT defined." + } + + - name: Create Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + release.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file