mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
fix workflow
This commit is contained in:
parent
5631fda6f6
commit
355b7cebf5
2 changed files with 64 additions and 75 deletions
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
|
@ -1,10 +1,9 @@
|
|||
name: Release
|
||||
|
||||
on: push
|
||||
#on:
|
||||
# push:
|
||||
# tags:
|
||||
# - v*
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
release:
|
||||
|
@ -36,15 +35,6 @@ jobs:
|
|||
shell: bash
|
||||
run: ./update.sh ${{secrets.TOKEN}} ${{matrix.os}}
|
||||
|
||||
- name: Update Result
|
||||
if: matrix.os == 'windows-latest'
|
||||
shell: cmd
|
||||
run: |
|
||||
type update.log
|
||||
dir
|
||||
dir dist
|
||||
dir dist\lib
|
||||
|
||||
- name: Update Deps
|
||||
run: npm run build:deps
|
||||
|
||||
|
|
121
update.sh
121
update.sh
|
@ -1,73 +1,72 @@
|
|||
#!/usr/bin/env bash
|
||||
{
|
||||
REPO="anytypeio/go-anytype-middleware"
|
||||
FILE="addon.tar.gz"
|
||||
GITHUB="api.github.com"
|
||||
|
||||
token=$1;
|
||||
platform=$2;
|
||||
arch="";
|
||||
REPO="anytypeio/go-anytype-middleware"
|
||||
FILE="addon.tar.gz"
|
||||
GITHUB="api.github.com"
|
||||
|
||||
if [ "$platform" = "ubuntu-latest" ]; then
|
||||
arch="linux";
|
||||
elif [ "$platform" = "macos-latest" ]; then
|
||||
arch="darwin";
|
||||
elif [ "$platform" = "windows-latest" ]; then
|
||||
arch="windows";
|
||||
FILE="addon.zip"
|
||||
fi;
|
||||
token=$1;
|
||||
platform=$2;
|
||||
arch="";
|
||||
|
||||
if [ "$token" = "" ]; then
|
||||
echo "ERROR: token is empty"
|
||||
exit 1
|
||||
fi;
|
||||
if [ "$platform" = "ubuntu-latest" ]; then
|
||||
arch="linux";
|
||||
elif [ "$platform" = "macos-latest" ]; then
|
||||
arch="darwin";
|
||||
elif [ "$platform" = "windows-latest" ]; then
|
||||
arch="windows";
|
||||
FILE="addon.zip"
|
||||
fi;
|
||||
|
||||
if [ "$arch" = "" ]; then
|
||||
echo "ERROR: arch not found"
|
||||
exit 1
|
||||
fi;
|
||||
if [ "$token" = "" ]; then
|
||||
echo "ERROR: token is empty"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
version=`curl -H "Authorization: token $token" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases | jq ".[0]"`
|
||||
tag=`echo $version | jq ".tag_name"`
|
||||
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?_$arch\";\"i\")))[0].id"`
|
||||
if [ "$arch" = "" ]; then
|
||||
echo "ERROR: arch not found"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
if [ "$asset_id" = "" ]; then
|
||||
echo "ERROR: version not found"
|
||||
exit 1
|
||||
fi;
|
||||
version=`curl -H "Authorization: token $token" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases | jq ".[0]"`
|
||||
tag=`echo $version | jq ".tag_name"`
|
||||
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"js_v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?_$arch\";\"i\")))[0].id"`
|
||||
|
||||
printf "Version: $tag\n"
|
||||
printf "Found asset: $asset_id\n"
|
||||
echo -n "Downloading file..."
|
||||
curl -sL -H "Authorization: token $token" -H 'Accept: application/octet-stream' "https://$GITHUB/repos/$REPO/releases/assets/$asset_id" > $FILE
|
||||
if [ "$asset_id" = "" ]; then
|
||||
echo "ERROR: version not found"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
printf "Version: $tag\n"
|
||||
printf "Found asset: $asset_id\n"
|
||||
echo -n "Downloading file..."
|
||||
curl -sL -H "Authorization: token $token" -H 'Accept: application/octet-stream' "https://$GITHUB/repos/$REPO/releases/assets/$asset_id" > $FILE
|
||||
printf "Done\n"
|
||||
|
||||
if [ "$platform" = "windows-latest" ]; then
|
||||
echo -n "Uncompressing... "
|
||||
unzip $FILE
|
||||
printf "Done\n"
|
||||
|
||||
echo "Moving... "
|
||||
mv -fv grpc-server.exe dist/anytypeHelper.exe
|
||||
else
|
||||
echo -n "Uncompressing... "
|
||||
tar -zxf $FILE
|
||||
printf "Done\n"
|
||||
|
||||
if [ "$platform" = "windows-latest" ]; then
|
||||
echo -n "Uncompressing... "
|
||||
unzip $FILE
|
||||
printf "Done\n"
|
||||
|
||||
echo "Moving... "
|
||||
mv -fv grpc-server.exe dist/anytypeHelper.exe
|
||||
else
|
||||
echo -n "Uncompressing... "
|
||||
tar -zxf $FILE
|
||||
printf "Done\n"
|
||||
echo "Moving... "
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
mv -fv addon/* build/
|
||||
rm -rf addon
|
||||
fi;
|
||||
|
||||
echo "Moving... "
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
mv -fv addon/* build/
|
||||
rm -rf addon
|
||||
fi;
|
||||
rm -rf dist/lib/pb
|
||||
rm -rf dist/lib/pkg
|
||||
rm -rf dist/lib/protos
|
||||
mv -fv protobuf/* dist/lib/
|
||||
rm -rf protobuf
|
||||
rm -rf $FILE
|
||||
printf "Done\n\n"
|
||||
|
||||
rm -rf dist/lib/pb
|
||||
rm -rf dist/lib/pkg
|
||||
rm -rf dist/lib/protos
|
||||
mv -fv protobuf/* dist/lib/
|
||||
rm -rf protobuf
|
||||
rm -rf $FILE
|
||||
printf "Done\n\n"
|
||||
|
||||
du -a dist/lib
|
||||
} | tee -a update.log
|
||||
du -a dist/lib
|
Loading…
Add table
Add a link
Reference in a new issue