Merge pull request 'ci: upload to gitea packages instead of s3' (#16) from jixunmoe/um-web:ci/use-gitea-packages into master
Reviewed-on: #16
This commit is contained in:
commit
5bb3c7851e
35
.drone.yml
35
.drone.yml
@ -4,34 +4,27 @@ type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build-wasm
|
||||
image: emscripten/emsdk:3.0.0
|
||||
commands:
|
||||
- ./scripts/build-wasm.sh
|
||||
|
||||
- name: build
|
||||
image: node:16.18-bullseye
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y cmake jq zip
|
||||
- ./scripts/build-wasm.sh
|
||||
- apt-get install -y jq zip
|
||||
- npm ci
|
||||
- npm run test
|
||||
- ./scripts/build-and-package.sh legacy
|
||||
- ./scripts/build-and-package.sh extension
|
||||
- ./scripts/build-and-package.sh modern
|
||||
- sha256sum *.zip > sha256sum.txt
|
||||
- mkdir -p upload
|
||||
- mv *.zip sha256sum.txt upload/
|
||||
|
||||
- name: upload
|
||||
image: "plugins/s3"
|
||||
settings:
|
||||
path_style: true
|
||||
endpoint:
|
||||
from_secret: S3_ENDPOINT
|
||||
access_key:
|
||||
from_secret: S3_ACCESS_KEY
|
||||
secret_key:
|
||||
from_secret: S3_SECRET_KEY
|
||||
bucket:
|
||||
from_secret: S3_BUCKET
|
||||
region: "auto"
|
||||
source: "upload/*"
|
||||
strip_prefix: "upload/"
|
||||
target: "${DRONE_REPO}/${DRONE_BUILD_NUMBER}/"
|
||||
- name: upload artifact
|
||||
image: node:16.18-bullseye
|
||||
environment:
|
||||
DRONE_GITEA_SERVER: https://git.unlock-music.dev
|
||||
GITEA_API_KEY:
|
||||
from_secret: GITEA_API_KEY
|
||||
commands:
|
||||
- ./scripts/upload-packages.sh
|
||||
|
19
scripts/upload-packages.sh
Executable file
19
scripts/upload-packages.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
if [ -z "$GITEA_API_KEY" ]; then
|
||||
echo "GITEA_API_KEY is empty, skip upload."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
URL_BASE="$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build"
|
||||
|
||||
for ZIP_NAME in *.zip; do
|
||||
UPLOAD_URL="${URL_BASE}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
|
||||
sha256sum "${ZIP_NAME}"
|
||||
curl -sLifu "um-release-bot:$GITEA_API_KEY" -T "${ZIP_NAME}" "${UPLOAD_URL}"
|
||||
echo "Uploaded to: ${UPLOAD_URL}"
|
||||
done
|
@ -8,29 +8,31 @@ CURR_DIR="${PWD}"
|
||||
|
||||
BUILD_TYPE="$1"
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE=Release
|
||||
BUILD_TYPE=Release
|
||||
fi
|
||||
|
||||
# CI: already had emsdk installed.
|
||||
if ! command -v emcc; then
|
||||
if [ ! -d ../../build/emsdk ]; then
|
||||
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||
fi
|
||||
|
||||
pushd ../../build/emsdk
|
||||
./emsdk install 3.0.0
|
||||
./emsdk activate 3.0.0
|
||||
source ./emsdk_env.sh
|
||||
popd # ../../build/emsdk
|
||||
fi
|
||||
|
||||
mkdir -p build/wasm
|
||||
if [ ! -d ../../build/emsdk ]; then
|
||||
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||
fi
|
||||
|
||||
pushd ../../build/emsdk
|
||||
#git pull
|
||||
./emsdk install 3.0.0
|
||||
./emsdk activate 3.0.0
|
||||
source ./emsdk_env.sh
|
||||
popd # ../../build/emsdk
|
||||
|
||||
pushd build/wasm
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
||||
make -j
|
||||
TARGET_FILES="
|
||||
KgmLegacy.js
|
||||
KgmWasm.js
|
||||
KgmWasm.wasm
|
||||
KgmWasmBundle.js
|
||||
KgmLegacy.js
|
||||
KgmWasm.js
|
||||
KgmWasm.wasm
|
||||
KgmWasmBundle.js
|
||||
"
|
||||
|
||||
cp $TARGET_FILES "${CURR_DIR}/"
|
||||
|
@ -8,28 +8,31 @@ CURR_DIR="${PWD}"
|
||||
|
||||
BUILD_TYPE="$1"
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE=Release
|
||||
BUILD_TYPE=Release
|
||||
fi
|
||||
|
||||
# CI: already had emsdk installed.
|
||||
if ! command -v emcc; then
|
||||
if [ ! -d ../../build/emsdk ]; then
|
||||
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||
fi
|
||||
|
||||
pushd ../../build/emsdk
|
||||
./emsdk install 3.0.0
|
||||
./emsdk activate 3.0.0
|
||||
source ./emsdk_env.sh
|
||||
popd # ../../build/emsdk
|
||||
fi
|
||||
|
||||
mkdir -p build/wasm
|
||||
if [ ! -d ../../build/emsdk ]; then
|
||||
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||
fi
|
||||
|
||||
pushd ../../build/emsdk
|
||||
./emsdk install 3.0.0
|
||||
./emsdk activate 3.0.0
|
||||
source ./emsdk_env.sh
|
||||
popd # ../../build/emsdk
|
||||
|
||||
pushd build/wasm
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
||||
make -j
|
||||
TARGET_FILES="
|
||||
QmcLegacy.js
|
||||
QmcWasm.js
|
||||
QmcWasm.wasm
|
||||
QmcWasmBundle.js
|
||||
QmcLegacy.js
|
||||
QmcWasm.js
|
||||
QmcWasm.wasm
|
||||
QmcWasmBundle.js
|
||||
"
|
||||
|
||||
cp $TARGET_FILES "${CURR_DIR}/"
|
||||
|
Loading…
Reference in New Issue
Block a user