Hexo #1244
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cayzlh.com | |
on: | |
push: | |
branches: | |
- master | |
repository_dispatch: | |
types: Hexo | |
jobs: | |
build: | |
name: Deploy cayzlh.com | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node_version: [ 20.12.0 ] | |
steps: | |
- name: Checkout self | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node_version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Configuration environment | |
env: | |
HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}} | |
GIT_USER: 'GitHub Action CI' | |
GIT_EMAIL: '[email protected]' | |
run: | | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
mkdir -p ~/.ssh/ | |
echo "$HEXO_DEPLOY_PRI" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.name "$GIT_USER" | |
git config --global user.email "$GIT_EMAIL" | |
- name: Checkout source | |
run: | | |
rm -rf source | |
git clone [email protected]:cayzlh/blog-private.git source | |
rm -rf ./source/.git | |
rm -rf ./source/.github | |
rm -rf ./_config.yml | |
mv ./source/_config.stellar.yml ./ | |
mv ./source/_config.site.yml ./_config.yml | |
- name: Checkout theme | |
run: | | |
git clone [email protected]:cayzlh/hexo-theme-stellar.git themes/stellar | |
rm -rf ./themes/stellar/_config.yml | |
mv ./source/_custom.styl ./themes/stellar/source/_custom.styl | |
mv ./source/speak.js ./themes/stellar/source/js/services/speak.js | |
- name: Cache Node Dependencies | |
id: cache | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: ${{runner.OS}}-npm-caches-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies. | |
run: | | |
npm install hexo-cli -g | |
npm install | |
- name: Deploy Github page. | |
run: | | |
export NODE_OPTIONS="--max-old-space-size=8192" | |
hexo clean | |
hexo g | |
hexo d | |
# - name: Deploy cloudbase. | |
# run: | | |
# tcb hosting deploy ./public -r gz -e ${{secrets.ENV_ID}} |