From 67e2ce245725d403467d8d3717fe927c5b893e2f Mon Sep 17 00:00:00 2001 From: kongo09 <kongo09@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:46:44 +0100 Subject: [PATCH] Update update-manifest.yml --- .github/workflows/update-manifest.yml | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-manifest.yml b/.github/workflows/update-manifest.yml index 4fac591..7e9dbcb 100644 --- a/.github/workflows/update-manifest.yml +++ b/.github/workflows/update-manifest.yml @@ -44,14 +44,28 @@ jobs: git push origin ${{ github.ref_name }} # Update the release - - name: Create Release - id: create_release - uses: actions/create-release@v1 + - name: Publish Draft Release + id: publish_release + uses: actions/github-script@v4 + with: + script: | + const { data: releases } = await github.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo + }); + + const draftRelease = releases.find(release => release.draft && release.tag_name === process.env.GITHUB_REF_NAME); + + if (draftRelease) { + await github.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: draftRelease.id, + draft: false + }); + } else { + core.setFailed('No draft release found'); + } env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: ${{ github.ref_name }} - draft: false - prerelease: ${{ github.event.release.prerelease }} - + GITHUB_REF_NAME: ${{ github.ref_name }}