From 71af5f8d0e62f005adf9681e77944f277eaabd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Sun, 15 Dec 2024 08:09:28 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=B8=8A=E4=BC=A0=20tar.gz=20=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 48 ++++++---------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fc253b..4ebaa4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,49 +123,15 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Check if Release exists - id: check_release - uses: actions/github-script@v6 - with: - script: | - try { - const { data: releases } = await github.repos.listReleases({ - owner: context.repo.owner, - repo: context.repo.repo - }); - const release = releases.find(r => r.tag_name === process.env.RELEASE_NAME); - if (release) { - core.setOutput('exists', true); - core.setOutput('id', release.id); - core.setOutput('upload_url', release.upload_url); - } else { - core.setOutput('exists', false); - } - } catch (error) { - core.setOutput('exists', false); - } - - - name: Create Release if not exists - if: steps.check_release.outputs.exists == 'false' + - name: Create Release id: create_release - uses: actions/github-script@v6 + uses: actions/create-release@v1 with: - script: | - const { data: release } = await github.repos.createRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: process.env.RELEASE_NAME, - name: "Latest Release", - body: "This is the latest release for the main branch.", - draft: false, - prerelease: false - }); - core.setOutput('id', release.id); - core.setOutput('upload_url', release.upload_url); - - - name: Get Upload URL for Existing Release - if: steps.check_release.outputs.exists == 'true' - run: echo "UPLOAD_URL=${{ steps.check_release.outputs.upload_url }}" >> $GITHUB_ENV + tag_name: ${{ github.ref_name }} + release_name: ${{ github.ref_name }} + draft: false + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} # 上传打包文件 - name: Upload app-amd64.tar.gz