1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p curl jq
5 nixpkgs
="$(git rev-parse --show-toplevel)"
6 castopod_nix
="$nixpkgs/pkgs/applications/audio/castopod/default.nix"
8 # https://www.meetup.com/api/guide/#p02-querying-section
10 query allReleases($fullPath: ID!, $first: Int, $last: Int, $before: String, $after: String, $sort: ReleaseSort) {
11 project(fullPath: $fullPath) {
30 fragment Release on Release {
56 "fullPath": "adaures/castopod",
58 "sort": "RELEASED_AT_DESC"
62 {"query": "$(echo $query)", "variables": $(echo $variables)}
66 json
="$(curl -s -X POST https://code.castopod.org/api/graphql \
67 -H 'Content-Type: application/json' \
71 TAG
=$
(echo $json | jq
-r '.data.project.releases.nodes[].tagName')
72 ASSET_URL
=$
(echo $json | jq
-r '.data.project.releases.nodes[].assets.links.nodes[].url' |
grep .
tar.gz$
)
74 CURRENT_VERSION
=$
(nix
eval -f "$nixpkgs" --raw castopod.version
)
77 if [[ "$CURRENT_VERSION" == "$VERSION" ]]; then
78 echo "castopod is up-to-date: ${CURRENT_VERSION}"
82 SHA256
=$
(nix-prefetch-url
"$ASSET_URL")
84 URL
=$
(echo $ASSET_URL |
sed -e 's/[\/&]/\\&/g')
86 sed -e "s/version =.*;/version = \"$VERSION\";/g" \
87 -e "s/url =.*;/url = \"$URL\";/g" \
88 -e "s/sha256 =.*;/sha256 = \"$SHA256\";/g" \