From 90adcf0c5bad68b599d1b623a6419f5da8ab0489 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sun, 21 Feb 2021 20:53:49 +0800 Subject: [PATCH] shell --- .github/workflows/npm-publish.yml | 2 +- _config.yml | 10 +++++----- publish.sh => npm-publish.sh | 9 +++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) rename publish.sh => npm-publish.sh (80%) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 7b48899..519a7dd 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -2,7 +2,7 @@ name: npm-publish on: push: branches: - - master + - npm jobs: npm-publish: name: npm-publish diff --git a/_config.yml b/_config.yml index 1f880ac..c532fc0 100755 --- a/_config.yml +++ b/_config.yml @@ -1,11 +1,11 @@ ######## Stellar info ######## stellar: - version: '1.0.0-rc.1' # This is theme's version. - homepage: https://xaoxuu.com/wiki/stellar/ - repo: https://github.com/xaoxuu/hexo-theme-stellar + version: '1.0.0-rc.1' + homepage: 'https://xaoxuu.com/wiki/stellar/' + repo: 'https://github.com/xaoxuu/hexo-theme-stellar' # The cdn version needs to be consistent with the stellar version - cdn_css: # https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/css/main.min.css - cdn_js: # https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/js/main.min.js + cdn_css: # 'https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/css/main.min.css' + cdn_js: # 'https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/js/main.min.js' ######## head tags ######## diff --git a/publish.sh b/npm-publish.sh similarity index 80% rename from publish.sh rename to npm-publish.sh index 9c233a9..761101d 100644 --- a/publish.sh +++ b/npm-publish.sh @@ -14,9 +14,14 @@ VERSION=$1 # 替换版本号 function prepare() { - text="'"${VERSION}"'"" # This is theme's version." + text="'"${VERSION}"'" sed -i "" "s/^ version:\([^\"]\{1,\}\)/ version: ${text}/g" '_config.yml' sed -i "" "s/^ \"version\":\([^,]\{1,\}\)/ \"version\": \"${VERSION}\"/g" 'package.json' + main=${VERSION%%.*} + sub=${VERSION#*.} + sub=${sub%%.*} + jsdelivr=$main'.'$sub + sed -i "" "s/\(cdn.jsdelivr.net\/npm\/hexo-theme-stellar@[^/]\{1,\}\)/cdn.jsdelivr.net\/npm\/hexo-theme-stellar@${jsdelivr}/g" '_config.yml' } # 提交 @@ -53,4 +58,4 @@ do esac done -prepare && commit +prepare #&& commit