-
Notifications
You must be signed in to change notification settings - Fork 1
/
.woodpecker_release.sh
23 lines (18 loc) · 1.06 KB
/
.woodpecker_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env sh
set -euxo pipefail
# build a release
mkdir schmu-latest
opam exec -- dune install --relocatable --prefix schmu-latest
tar cavf schmu-latest.tbz schmu-latest
# delete old release file
dd of=auth <<< "Authorization: Bearer $RELEASE"
curl -sS -X 'GET' 'https://codeberg.org/api/v1/repos/tjammer/schmu/releases/1933295/assets' -H 'accept: application/json' | jq '.[] | .id' | xargs -I{} curl -X 'DELETE' 'https://codeberg.org/api/v1/repos/tjammer/schmu/releases/1933295/assets/{}' -H 'accept: application/json' -H @auth
# add new one
curl -sS -X 'POST' 'https://codeberg.org/api/v1/repos/tjammer/schmu/releases/1933295/assets?name=schmu-latest.tbz' -H 'accept: application/json' -H 'Content-Type: multipart/form-data' -F 'attachment=@schmu-latest.tbz;type=application/x-bzip-compressed-tar' -H @auth
# update release commit
curl -sS -X 'PATCH' \
'https://codeberg.org/api/v1/repos/tjammer/schmu/releases/1933295' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H @auth \
-d "{ \"target_commitish\": \"$(git rev-parse HEAD)\"}"