@@ 13,7 13,7 @@ do
upstream="$OPTARG"
;;
t)
- legacy_token="$OPTARG"
+ bearer_token="$OPTARG"
;;
h)
echo "Usage: $0 [-u https://upstream...] [-t oauth token] <packages...>"
@@ 39,13 39,24 @@ do
fi
fi
done
-sed "s/packages: \\[\\]/packages: [$builds]/g" < build.yml | jq -sR '{
- "manifest": .,
- "tags": ["sr.ht-apkbuilds"],
- "note": "'"$note"'"
- }' | curl \
- -H Authorization:"token $legacy_token" \
+
+vars="$(sed "s/packages: \\[\\]/packages: [$builds]/g" < build.yml | jq -sR '{
+ "manifest": .,
+ "tags": ["sr.ht-apkbuilds"],
+ "note": "'"$note"'"
+}')"
+query="$(jq -sR '.' <<"EOF"
+mutation SubmitJob($manifest: String!, $tags: [String!]!, $note: String!) {
+ submit(manifest: $manifest, tags: $tags, note: $note) {
+ id, tags
+ }
+}
+EOF
+)"
+
+curl --oauth2-bearer "$bearer_token" \
-H Content-Type:application/json \
- -X POST \
- -d @- $upstream/api/jobs
-printf '\n'
+ -d '{
+ "query": '"$query"',
+ "variables": '"$vars"'
+ }' "$upstream/query" | jq .