Compare commits
No commits in common. "c579fb1928da7715e78ef1337bfdcbc29c6a1a11" and "c4dbaa4b73c9aa5f427e8dcbbb32b7703bff92f0" have entirely different histories.
c579fb1928
...
c4dbaa4b73
30
.drone.yml
30
.drone.yml
@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test & build
|
|
||||||
image: node:18.16.0-bullseye
|
|
||||||
commands:
|
|
||||||
# - git config --global --add safe.directory "/drone/src"
|
|
||||||
- npm install -g pnpm
|
|
||||||
- pnpm i --frozen-lockfile
|
|
||||||
- pnpm build
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: node:18.16.0-bullseye
|
|
||||||
environment:
|
|
||||||
DRONE_GITEA_SERVER: https://git.unlock-music.dev
|
|
||||||
GITEA_API_KEY:
|
|
||||||
from_secret: GITEA_API_KEY
|
|
||||||
NETLIFY_SITE_ID:
|
|
||||||
from_secret: NETLIFY_SITE_ID
|
|
||||||
NETLIFY_API_KEY:
|
|
||||||
from_secret: NETLIFY_API_KEY
|
|
||||||
commands:
|
|
||||||
# - git config --global --add safe.directory "/drone/src"
|
|
||||||
- apt-get update && apt-get install -y zip jq tar gzip curl
|
|
||||||
- (cd dist && zip -r -9 ../um-react.zip .)
|
|
||||||
- ./scripts/publish.sh
|
|
||||||
- ./scripts/deploy.sh
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -23,7 +23,3 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
# Files created when running "drone exec" locally
|
|
||||||
/.pnpm-store/
|
|
||||||
/*.zip
|
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
#!/bin/bash -ex
|
|
||||||
|
|
||||||
BRANCH_NAME="$(git branch --show-current)"
|
|
||||||
|
|
||||||
__netlify_upload() {
|
|
||||||
curl -sL \
|
|
||||||
-H "Content-Type: application/zip" \
|
|
||||||
-H "Authorization: Bearer ${NETLIFY_API_KEY}" \
|
|
||||||
--data-binary "@${1}" \
|
|
||||||
"https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/deploys?branch=${BRANCH_NAME}"
|
|
||||||
}
|
|
||||||
|
|
||||||
__netlify_get_deploy() {
|
|
||||||
local deploy_id="$1"
|
|
||||||
curl -sL \
|
|
||||||
-H "Authorization: Bearer ${NETLIFY_API_KEY}" \
|
|
||||||
"https://api.netlify.com/api/v1/deploys/${deploy_id}"
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy_netlify() {
|
|
||||||
local upload_resp
|
|
||||||
upload_resp="$(__netlify_upload "$1")"
|
|
||||||
|
|
||||||
local error_message="$(echo "$upload_resp" | jq -r ".message // .error_message")"
|
|
||||||
if [[ "$error_message" != "null" ]]; then
|
|
||||||
echo "Deploy to netlify failed:"
|
|
||||||
echo " * ${error_message}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local deploy_id="$(echo "$upload_resp" | jq -r ".id")"
|
|
||||||
local deploy_resp=""
|
|
||||||
local deploy_state=""
|
|
||||||
local retry_count=10
|
|
||||||
while [[ "$retry_count" -gt 0 ]]; do
|
|
||||||
deploy_resp="$(__netlify_get_deploy "$deploy_id")"
|
|
||||||
deploy_state="$(echo "$deploy_resp" | jq -r '.state')"
|
|
||||||
case "$deploy_state" in
|
|
||||||
ready)
|
|
||||||
echo 'Deploy to netlify OK!'
|
|
||||||
echo " * main url: $(echo "$deploy_resp" | jq -r '.ssl_url')"
|
|
||||||
echo " * branch: $(echo "$deploy_resp" | jq -r '.deploy_ssl_url')"
|
|
||||||
echo " * permalink: $(echo "$deploy_resp" | jq -r '.links.permalink')"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
error)
|
|
||||||
echo "Deploy to netlify failed:"
|
|
||||||
echo " * $(echo "$deploy_resp" | jq -r '.error_message')"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
retry_count="$((retry_count - 1))"
|
|
||||||
sleep 3
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# For deployment, we care a bit less
|
|
||||||
if [[ -n "${NETLIFY_API_KEY}" && -n "${NETLIFY_SITE_ID}" ]]; then
|
|
||||||
echo "Deploy to netlify..."
|
|
||||||
deploy_netlify um-react.zip
|
|
||||||
fi
|
|
@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash -ex
|
|
||||||
|
|
||||||
BRANCH_NAME="$(git branch --show-current)"
|
|
||||||
|
|
||||||
publish_gitea() {
|
|
||||||
local ZIP_NAME="$1"
|
|
||||||
local URL="${DRONE_GITEA_SERVER}/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
|
|
||||||
sha256sum "${ZIP_NAME}"
|
|
||||||
curl -sLifu "um-release-bot:${GITEA_API_KEY}" -T "${ZIP_NAME}" "${URL}"
|
|
||||||
echo "Uploaded to: ${URL}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Only publish main branch by default
|
|
||||||
if [[ "${BRANCH_NAME}" = "main" ]]; then
|
|
||||||
echo 'prepare to publish...'
|
|
||||||
|
|
||||||
if [[ -n "${GITEA_API_KEY}" ]]; then
|
|
||||||
echo "Publish to gitea..."
|
|
||||||
publish_gitea "um-react.zip"
|
|
||||||
fi
|
|
||||||
fi
|
|
@ -1 +0,0 @@
|
|||||||
// This is a dummy module for vite/rollup to resolve.
|
|
@ -23,9 +23,6 @@ const version = `${pkg.version}-${shortCommit}`;
|
|||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
worker: {
|
|
||||||
format: 'es',
|
|
||||||
},
|
|
||||||
server: {
|
server: {
|
||||||
fs: {
|
fs: {
|
||||||
// Note:
|
// Note:
|
||||||
@ -88,7 +85,6 @@ export default defineConfig({
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, 'src'),
|
'~': path.resolve(__dirname, 'src'),
|
||||||
module: path.resolve(__dirname, 'src', 'dummy.mjs'),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
Loading…
Reference in New Issue
Block a user