diff --git a/.github/workflows/update-release-draft.yml b/.github/workflows/update-release-draft.yml new file mode 100644 index 000000000..112fea743 --- /dev/null +++ b/.github/workflows/update-release-draft.yml @@ -0,0 +1,67 @@ +name: Update Release Draft + +on: + workflow_dispatch: + inputs: + artifact_name: + required: true + type: string + default: "FicsItNetworks" + workflow_call: + inputs: + artifact_name: + required: true + type: string + +permissions: + actions: read + +jobs: + update-release-draft: + name: Update Release Draft + runs-on: ubuntu-latest + steps: + - name: Find Release Draft + uses: actions/github-script@v7 + id: find-release-draft + with: + script: | + const response = await github.rest.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 1, + }); + const release = response.data[0]; + if (!release.draft) { + core.setFailed('Found Release is not a draft!'); + return; + } + return release.id; + + - name: Find FicsIt-Networks Binary + uses: actions/github-script@v7 + id: find-ficsit-networks + with: + script: | + const response = await github.rest.actions.listArtifactsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 1, + name: "${{ inputs.artifact_name }}" + }); + return response.data.artifacts[0].workflow_run.id; + + - name: Download FicsIt-Networks + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_name }} + run-id: ${{ steps.find-ficsit-networks.outputs.result }} + path: ${{ github.workspace }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload To Github Release + uses: xresloader/upload-to-github-release@v1.6.0 + with: + file: "*.zip" + overwrite: true + release_id: ${{ steps.find-release-draft.outputs.result }}