From 5d33cc03b1de16e1ea6a804773edc0619883f9fb Mon Sep 17 00:00:00 2001 From: Michel Date: Tue, 12 Nov 2024 10:54:20 -0500 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab5a974..78603b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,11 @@ on: - published # Runs when a release is published workflow_dispatch: # Allows manual triggering +permissions: + contents: write # Required to upload assets + actions: write # Required for actions to work correctly + id-token: write # For authentication if needed + jobs: build: runs-on: ubuntu-latest @@ -49,8 +54,18 @@ jobs: zip -r ../slm-plus.zip slm-plus shell: bash - # Step 5: Upload the ZIP as a release asset + # Step 5: Create a Release (if push event) + - name: Create a Release (if push) + if: github.event_name == 'push' + run: | + TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///') + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{"tag_name": "'$TAG_NAME'", "name": "'$TAG_NAME'"}' \ + https://api.github.com/repos/${{ github.repository }}/releases + + # Step 6: Upload ZIP to Release (only if release is published) - name: Upload ZIP to Release + if: github.event_name == 'release' && github.event.action == 'published' uses: actions/upload-release-asset@v1 with: upload_url: ${{ github.event.release.upload_url }}