Skip to content

Commit

Permalink
fix(build): upload asset for a repository_dispatch event
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthlatest committed Sep 29, 2024
1 parent 9876f53 commit 14df212
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,32 @@ jobs:
echo "Error: Version is not set."
exit 1
fi
- name: Build Dejavu App
run: yarn build:dejavu:app

- name: Zip the dist folder
run: |
zip -r dist-${{ steps.set_version.outputs.version }}.zip ./packages/dejavu-main/dist
# Fetch release by tag using GitHub API
- name: Get release by tag
if: ${{ github.event_name == 'repository_dispatch' }}
id: get_release
run: |
release_url=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.set_version.outputs.version }}" \
| jq -r '.upload_url')
release_url=$(echo $release_url | sed -e "s/{?name,label}//") # Strip unnecessary part of URL
echo "upload_url=$release_url" >> $GITHUB_OUTPUT
# Use the extracted release upload URL for uploading the asset
- name: Upload dist.zip to GitHub Release
if: ${{ github.event_name == 'release' || github.event_name == 'repository_dispatch' }}
if: ${{ github.event_name == 'repository_dispatch' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./dist-${{ steps.set_version.outputs.version }}.zip
asset_name: dejavu-dist-${{ steps.set_version.outputs.version }}.zip
asset_content_type: application/zip
asset_content_type: application/zip

0 comments on commit 14df212

Please sign in to comment.