From bb2c9b7320917c7d2bd39ce6b892851ebbc7b359 Mon Sep 17 00:00:00 2001 From: krrishnaaaa Date: Sun, 13 Oct 2024 14:57:03 +0530 Subject: [PATCH] fixed release workflow --- .github/workflows/release.yml | 55 +++++++++-------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e03970..5bac337 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,47 +25,18 @@ jobs: - name: 🚧 Build with Gradle run: ./gradlew shadowJar --no-daemon - # Step 4: Create a new release + release: + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v4 - name: 📦 Create Release - id: create_release - uses: actions/github-script@v6 - with: - script: | - const { exec } = require('child_process'); - const { promises: fs } = require('fs'); - - // Get the latest tag - const tag = context.ref.replace('refs/tags/', ''); - - // Read the release notes if available - const releaseNotes = await fs.readFile('CHANGELOG.md', 'utf-8').catch(() => 'No release notes.'); - - // Create the release - const release = await github.rest.repos.createRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: tag, - name: tag, - body: releaseNotes, - draft: false, - prerelease: false, - }); - - return release.data; - - # Step 5: Upload the shadowJar artifact to the release - - name: 🎁 Upload shadowJar to Release - id: upload_jar - run: | - # Find the generated JAR file name - jar_file=$(ls build/libs/*.jar | grep -v '\-javadoc' | grep -v '\-sources' | head -n 1) - echo "Found JAR file: $jar_file" - echo "jar_file_name=$jar_file" >> $GITHUB_ENV - - - name: 🎁 Upload shadowJar to Release - uses: actions/upload-release-asset@v1 + uses: Roang-zero1/github-create-release-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload release artifacts + uses: Roang-zero1/github-upload-release-artifacts-action@v3 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.jar_file_name }} - asset_name: ${{ env.jar_file_name }} # Use the dynamic name here - asset_content_type: application/java-archive + args: "build/libs" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}