Skip to content

Commit

Permalink
什么什么
Browse files Browse the repository at this point in the history
  • Loading branch information
MCSeekeri committed Sep 7, 2024
1 parent 8a0a1ca commit 421790b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 48 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
persist-credentials: false
fetch-depth: 0

- name: Setup Node.js 20.x
- name: Setup Node.js 22.x
uses: actions/setup-node@main
with:
node-version: 20
node-version: 22
registry-url: https://registry.npmjs.org


- name: 设置Hexo环境
- name: 设置 Hexo 环境
env:
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }}
run: |
Expand All @@ -37,12 +37,12 @@ jobs:
env:
BAIDU_TOKEN: ${{ secrets.BAIDU_TOKEN }}
BING_TOKEN: ${{ secrets.BING_TOKEN }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
GOOGLE_KEY: ${{ secrets.GOOGLE_TOKEN }}
run: |
echo "$GOOGLE_TOKEN" | tr -d '\r' >> $GITHUB_WORKSPACE/push.json
echo "$GOOGLE_KEY" | tr -d '\r' >> $GITHUB_WORKSPACE/push.json
hexo generate && gulp && hexo deploy
# - name: 部署到Cloudflare Workers
# - name: 部署到 Cloudflare Workers
# uses: cloudflare/wrangler-action@1.3.0
# with:
# apiToken: ${{ secrets.CF_WORKERS_TOKEN }}
28 changes: 25 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@ hexo_submit_urls_to_search_engine:
# find_what: sciadv.top
# replace_with: lib.sci-adv.cc

url_submission:
enable: true
type: 'all' # latest or all( latest: modified pages; all: posts & pages)
channels: # included channels are `baidu`, `google`, `bing`, `shenma`
baidu:
token: "" # Baidu Private Token
count: 10 # Optional
bing:
token: "" # Bing Access Token
count: 10 # Optional
google:
key: "push.json" # Google key path (e.g. `google_key.json` or `data/google_key.json`)
count: 10 # Optional
shenma:
count: 10 # Optional
user: "" # Username used when registering
token: "" # ShenMa Private Key
prefix: ['/archives', '/categories', '/tags'] # URL prefix
#ignore: ["/post/a*", "/post/a?c"] # URL addresses that do not need to be submitted (wildcards are supported)
count: 50 # Submit limit
urls_path: 'submit_url.txt' # URL list file path
sitemap: 'https://lib.sci-adv.cc/sitemap.xml' # Sitemap path(e.g. the url is like this https://abnerwei.com/baidusitemap.xml, you can fill in `baidusitemap.xml`)


import:
head_begin:
- <link rel="manifest" href="/manifest.json">
Expand Down Expand Up @@ -171,6 +195,4 @@ deploy:
repository:
github: git@github.com:MCSeekeri/sciadv-site
branch: master
- type: cjh_bing_url_submitter
- type: cjh_baidu_url_submitter
- type: cjh_google_url_submitter
- type: url_submission
54 changes: 20 additions & 34 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,31 @@
var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var htmlmin = require('gulp-html-minifier-terser');
var htmlclean = require('gulp-htmlclean');
var terser = require('gulp-terser');
const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');
const htmlmin = require('gulp-htmlmin');
const terser = require('gulp-terser');

// 压缩css文件
const minify_css = () => (
gulp.src(['./public/**/*.css'])
.pipe(minifycss())
.pipe(gulp.dest('./public'))
);
gulp.task('minify_css', () => {
return gulp.src('./public/**/*.css')
.pipe(cleanCSS({compatibility: '*'}))
.pipe(gulp.dest('./public'));
});

// 压缩html文件
const minify_html = () => (
gulp.src(['./public/**/*.html','!./public/{lib,lib/**}'])
.pipe(htmlclean())
gulp.task('minify_html', function() {
return gulp.src(['./public/**/*.html', '!./public/{lib,lib/**}'])
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
}))
.pipe(gulp.dest('./public'))
)
.pipe(gulp.dest('./public'));
});

// 压缩js文件
const minify_js = () => (
gulp.src(['./public/**/*.js', '!./public/**/*.min.js','!./public/{lib,lib/**}'])
gulp.task('minify_js', function() {
return gulp.src(['./public/**/*.js', '!./public/**/*.min.js', '!./public/{lib,lib/**}'])
.pipe(terser())
.pipe(gulp.dest('./public'))
)
.pipe(gulp.dest('./public'));
});

module.exports = {
minify_html: minify_html,
minify_css: minify_css,
minify_js: minify_js
};
gulp.task('one', gulp.parallel(
minify_html,
minify_css,
minify_js
))

gulp.task('default', gulp.series('one'));
gulp.task('one', gulp.parallel('minify_html', 'minify_css', 'minify_js'));
gulp.task('default', gulp.series('one'));
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@
"hexo-renderer-marked": "^6.3.0",
"hexo-renderer-stylus": "^3.0.1",
"hexo-server": "^3.0.0",
"hexo-submit-urls-to-search-engine": "^2.1.0",
"hexo-url-submission": "^2.0.0",
"hexo-wordcount": "^6.0.1"
},
"devDependencies": {
"gulp": "^5.0.0",
"gulp-html-minifier-terser": "^7.1.0",
"gulp-htmlclean": "^2.7.22",
"gulp-clean-css": "^4.3.0",
"gulp-htmlmin": "^5.0.1",
"gulp-minify-css": "^1.2.4",
"gulp-terser": "^2.1.0"
}
}
}

1 comment on commit 421790b

@vercel
Copy link

@vercel vercel bot commented on 421790b Sep 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.