CI: 替换 Drone CI 为 Gitea 内建的 Actions #80
35
.drone.yml
35
.drone.yml
@ -1,35 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: test & build
|
||||
image: node:22.12.0-bookworm
|
||||
commands:
|
||||
# - git config --global --add safe.directory "/drone/src"
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@latest --activate
|
||||
- pnpm i --frozen-lockfile
|
||||
- pnpm build
|
||||
environment:
|
||||
# 让 npm 使用淘宝源
|
||||
npm_config_registry: https://registry.npmmirror.com
|
||||
|
||||
- name: publish
|
||||
image: node:22.12.0-bookworm
|
||||
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:
|
||||
- |
|
||||
python3 -m zipfile -c um-react.zip dist/.
|
||||
cp um-react.zip dist/"release-${DRONE_COMMIT_SHA}.zip"
|
||||
python3 -m zipfile -c um-react-site.zip dist/.
|
||||
- ./scripts/publish.sh
|
||||
- ./scripts/deploy.sh
|
@ -11,5 +11,5 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{{c,m,}js{x,on,},ts{x,}}]
|
||||
[*.{{c,m,}js{x,on,},ts{x,},y{,a}ml}]
|
||||
indent_size = 2
|
||||
|
35
.gitea/workflows/build.yaml
Normal file
35
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
name: Build and Deploy
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
npm_config_registry: https://registry.npmmirror.com
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4.0.0
|
||||
with:
|
||||
standalone: true
|
||||
run_install: |
|
||||
- args: [--frozen-lockfile, --strict-peer-dependencies]
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
- name: Prepare for deployment
|
||||
run: |
|
||||
python3 -m zipfile -c um-react.zip dist/.
|
||||
cp um-react.zip dist/"release-${GITHUB_SHA}.zip"
|
||||
python3 -m zipfile -c um-react-site.zip dist/.
|
||||
- name: Publish Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: site
|
||||
path: dist/
|
||||
- name: Deploy
|
||||
env:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
NETLIFY_API_KEY: ${{ secrets.NETLIFY_API_KEY }}
|
||||
run: |
|
||||
./scripts/deploy.sh
|
@ -103,7 +103,7 @@ deploy_netlify() {
|
||||
|
||||
# For deployment, we care a bit less
|
||||
if [[ -n "${NETLIFY_API_KEY}" && -n "${NETLIFY_SITE_ID}" ]]; then
|
||||
echo "Deploy to netlify..."
|
||||
echo "Deploy to netlify (branch: ${BRANCH_NAME})..."
|
||||
deploy_netlify um-react-site.zip
|
||||
else
|
||||
echo "skip netlify deployment."
|
||||
|
Loading…
Reference in New Issue
Block a user