gitea: add workflow for CI/CD
This commit is contained in:
49
.gitea/workflows/main.yml
Normal file
49
.gitea/workflows/main.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: 自动部署
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
# Gitea 支持 release 触发,但确保你的 Gitea 版本较新
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
# 这里的 ubuntu-latest 对应你 runner config 里定义的 label
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 检查分支
|
||||||
|
uses: actions/checkout@v4 # 建议先用 v4,兼容性最稳
|
||||||
|
with:
|
||||||
|
# Gitea 中默认不需要专门传 token 即可 checkout 公开仓库
|
||||||
|
# 但为了 push 回去,我们保持 fetch-depth
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 缓存项目 npm 包
|
||||||
|
id: cache-node-modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package-lock.json') }}-${{ hashFiles('package.json') }}
|
||||||
|
|
||||||
|
- name: 安装 Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
|
||||||
|
- name: 安装依赖并生成
|
||||||
|
run: |
|
||||||
|
npm install -g hexo-cli
|
||||||
|
npm install
|
||||||
|
npm run clean
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: 通知服务器 Hook
|
||||||
|
run: |
|
||||||
|
curl -k -X POST "https://45.145.229.95:40606/hook?access_key=1XJG8IvYTSZVvD5dpm86GYIpQxgxBcucULnX1MFskZSKayXU"
|
||||||
20
package-lock.json
generated
20
package-lock.json
generated
@@ -73,9 +73,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/generator": {
|
"node_modules/@babel/generator": {
|
||||||
"version": "7.29.0",
|
"version": "7.29.1",
|
||||||
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@babel/generator/-/generator-7.29.0.tgz",
|
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@babel/generator/-/generator-7.29.1.tgz",
|
||||||
"integrity": "sha512-vSH118/wwM/pLR38g/Sgk05sNtro6TlTJKuiMXDaZqPUfjTFcudpCOt00IhOfj+1BFAX+UFAlzCU+6WXr3GLFQ==",
|
"integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.29.0",
|
"@babel/parser": "^7.29.0",
|
||||||
@@ -1347,7 +1347,7 @@
|
|||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://mirrors.huaweicloud.com/repository/npm/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://mirrors.huaweicloud.com/repository/npm/glob/-/glob-7.2.3.tgz",
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||||
"deprecated": "Glob versions prior to v9 are no longer supported",
|
"deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs.realpath": "^1.0.0",
|
"fs.realpath": "^1.0.0",
|
||||||
@@ -3308,9 +3308,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/p-limit": {
|
"node_modules/p-limit": {
|
||||||
"version": "7.2.0",
|
"version": "7.3.0",
|
||||||
"resolved": "https://mirrors.huaweicloud.com/repository/npm/p-limit/-/p-limit-7.2.0.tgz",
|
"resolved": "https://mirrors.huaweicloud.com/repository/npm/p-limit/-/p-limit-7.3.0.tgz",
|
||||||
"integrity": "sha512-ATHLtwoTNDloHRFFxFJdHnG6n2WUeFjaR8XQMFdKIv0xkXjrER8/iG9iu265jOM95zXHAfv9oTkqhrfbIzosrQ==",
|
"integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yocto-queue": "^1.2.1"
|
"yocto-queue": "^1.2.1"
|
||||||
@@ -4127,9 +4127,9 @@
|
|||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "7.20.0",
|
"version": "7.21.0",
|
||||||
"resolved": "https://mirrors.huaweicloud.com/repository/npm/undici/-/undici-7.20.0.tgz",
|
"resolved": "https://mirrors.huaweicloud.com/repository/npm/undici/-/undici-7.21.0.tgz",
|
||||||
"integrity": "sha512-MJZrkjyd7DeC+uPZh+5/YaMDxFiiEEaDgbUSVMXayofAkDWF1088CDo+2RPg7B1BuS1qf1vgNE7xqwPxE0DuSQ==",
|
"integrity": "sha512-Hn2tCQpoDt1wv23a68Ctc8Cr/BHpUSfaPYrkajTXOS9IKpxVRx/X5m1K2YkbK2ipgZgxXSgsUinl3x+2YdSSfg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.18.1"
|
"node": ">=20.18.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user