This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
create_release.sh
executable file
·43 lines (32 loc) · 1.89 KB
/
create_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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
git fetch && git rebase origin/main
VERSION=$(python setup.py --version)
VIRTUALENV=build/virtualenv
echo "\x1B[31m******* DANGER ********\x1B[0m"
echo Creating a new release for v$VERSION
echo This is going to upload files to upload files to AWS, create a github release and change the pypi registry
read -p 'Are you sure you want to proceed (y/n)? ' PROCEED
if [[ ! $PROCEED =~ ^[Yy]$ ]]
then
exit 1
fi
$VIRTUALENV/bin/python3 setup.py sdist bdist_wheel
aws s3 sync dist/ s3://datalabs-packages/wellcomeml
aws s3 cp --recursive --acl public-read dist/ s3://datalabs-public/wellcomeml
$VIRTUALENV/bin/python -m twine upload --repository pypi --username $TWINE_USERNAME --password $TWINE_PASSWORD dist/*
curl --request POST \
--url https://api.github.com/repos/wellcometrust/wellcomeml/releases \
--header 'authorization: token '$GITHUB_TOKEN'' \
--header 'content-type: application/json' \
--data '{
"tag_name": "v'$VERSION'",
"target_commitish": "main",
"name": "v'$VERSION'",
"prerelease": false
}'
RELEASE_ID=$(curl -XGET --silent "https://api.github.com/repos/wellcometrust/WellcomeML/releases/tags/v$VERSION" | jq .id)
cd dist/
curl --request POST --silent --header "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $(file -b --mime-type wellcomeml-$VERSION.tar.gz)" --data-binary @wellcomeml-$VERSION.tar.gz --url "https://uploads.github.com/repos/wellcometrust/WellcomeML/releases/$RELEASE_ID/assets?name=wellcomeml-$VERSION.tar.gz"
curl --request POST --silent --header "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $(file -b --mime-type wellcomeml-$VERSION.tar.gz)" --data-binary @wellcomeml-$VERSION.tar.gz --url "https://uploads.github.com/repos/wellcometrust/WellcomeML/releases/$RELEASE_ID/assets?name=wellcomeml-$VERSION-py3-none-any.whl"
echo "Release created"
echo "Please change the description at https://github.com/wellcometrust/WellcomeML/releases/tag/v$VERSION"