Update .gitignore to Exclude Binary Files (#163) #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Scripts Zip to Latest Release | |
on: | |
push: | |
paths: | |
- "source/zip/scripts.zip" | |
permissions: | |
contents: write | |
jobs: | |
upload_zip_to_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Latest Release Info | |
id: get_latest_release_info | |
run: | | |
latest_release=$(curl -s \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/latest) | |
upload_url=$(echo "$latest_release" | jq -r '.upload_url' | sed 's/{?name,label}//') | |
release_id=$(echo "$latest_release" | jq -r '.id') | |
echo "upload_url=$upload_url" >> $GITHUB_ENV | |
echo "release_id=$release_id" >> $GITHUB_ENV | |
- name: Remove Existing scripts.zip Asset (if present) | |
run: | | |
assets=$(curl -s \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/$release_id/assets) | |
asset_id=$(echo "$assets" | jq -r '.[] | select(.name == "scripts.zip") | .id') | |
if [ -n "$asset_id" ]; then | |
echo "Removing existing scripts.zip asset with ID $asset_id" | |
curl -X DELETE \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id | |
else | |
echo "No existing scripts.zip asset found." | |
fi | |
- name: Upload Zip File to Latest Release | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/zip" \ | |
--data-binary @source/zip/scripts.zip \ | |
"$upload_url?name=scripts.zip" |