github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/scripts/upload-snap.bash (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  set -o pipefail
     5  
     6  tag_name="v$(ls -1 dist/upm_*.tar.gz | grep -Eo '[0-9.]+' | head -n1)"
     7  
     8  release_id="$(curl -s https://api.github.com/repos/replit/upm/releases \
     9                     -H "Authorization: token $GITHUB_TOKEN" | jq "map(select(.tag_name == \"$tag_name\")) | .[0].id")"
    10  
    11  if [[ -z "$release_id" ]]; then
    12      echo "no release id" >&2
    13      exit 1
    14  fi
    15  
    16  for file in dist/*.snap; do
    17      curl "https://uploads.github.com/repos/replit/upm/releases/${release_id}/assets?name=$(basename "$file")" \
    18           --silent \
    19           --data-binary @"${file}" \
    20           -H "Authorization: token ${GITHUB_TOKEN}" \
    21           -H "Content-Type: application/octet-stream" | jq
    22  done