From 25c084875de9bfbc57d734a26d9c25887fd699b2 Mon Sep 17 00:00:00 2001 From: Shahzad Afridi Date: Thu, 29 Aug 2024 20:07:06 +0500 Subject: [PATCH] Updated generate-artifact-links --- .github/workflows/main.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b177da..fc8ed73 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -165,15 +165,24 @@ jobs: # Workflow block for generating artifact links generate-artifact-links: runs-on: ubuntu-latest - needs: [ build-android, build-ios, build-desktop,build-macos, build-web ] + needs: [ build-android, build-ios, build-desktop, build-web ] steps: - name: Checkout code uses: actions/checkout@v4 - - name: List artifacts + - name: Get Artifact URLs + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: | + # Get the run ID + RUN_ID=$(echo "${{ github.run_id }}") + REPO=${{ github.repository }} + + # Fetch the list of artifacts + ARTIFACTS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$REPO/actions/runs/$RUN_ID/artifacts") + + # Extract URLs for each artifact echo "Artifact URLs for download:" - echo "Android APK: ${{ needs.build-android.outputs.artifact-url }}" - echo "iOS Framework: ${{ needs.build-ios.outputs.artifact-url }}" - echo "Desktop JAR: ${{ needs.build-desktop.outputs.artifact-url }}" - echo "Web App: ${{ needs.build-web.outputs.artifact-url }}" + for url in $(echo "$ARTIFACTS" | jq -r '.artifacts[] | "\(.name) - \(.archive_download_url)"'); do + echo "$url" + done