Skip to content

新增byteAcc

新增byteAcc #114

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: deploy
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
paths:
- 'markdown/**'
- 'deploy/**'
- '.github/**'
pull_request:
branches: [ "main" ]
paths:
- 'markdown/**'
- 'deploy/**'
- '.github/**'
# 每周日0点构建
schedule:
- cron: "0 0 * * 0"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
lfs: 'true'
# 部署 node.js
- uses: actions/[email protected]
with:
node-version: lts/*
# 部署 pandoc
- name: Setup pandoc
uses: nikeee/setup-pandoc@master
# 部署 yq
- name: Setup yq
run: sudo snap install yq
# 部署 SSH 认证
- name: Config SSH
env:
ACTION_DEPLOY_KEY: ${{ secrets.HEXO_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.email "[email protected]"
git config --global user.name "smilelc3"
# 部署 wasm
- name: Setup wasm
run: |
mkdir cd ${{github.workspace}}/js && cd ${{github.workspace}}/js/
git clone --depth=1 https://github.com/smilelc3/MyLittleTool.git
sudo apt install emscripten -y
emcc MyLittleTool/Hex2Ascii.cpp MyLittleTool/Ascii2Hex.cpp MyLittleTool/Linear11Trans.cpp MyLittleTool/checksum_byteacc.cpp -D WASM_EMCC -o MyLittleTool.js -Oz -flto -s WASM=1 -s EXPORTED_FUNCTIONS='["_malloc", "_free"]' -s "EXPORTED_RUNTIME_METHODS=['cwrap']" -s ALLOW_MEMORY_GROWTH -s ASSERTIONS=1
rm -rf MyLittleTool
cd -
# 构建和部署 hexo
- name: build and deploy hexo
run: |
npm install hexo-cli
export PATH="$PATH:./node_modules/.bin"
hexo init "blog"
cd blog
npm install
npm install hexo-theme-next
npm install hexo-deployer-git
npm uninstall hexo-renderer-marked
npm install hexo-renderer-pandoc
npm install hexo-symbols-count-time
npm install hexo-generator-searchdb
# 定制化和复制博客
bash ${{github.workspace}}/deploy/_config.yml_modify.sh $(pwd)/_config.yml
cp ./node_modules/hexo-theme-next/_config.yml ./_config.next.yml && bash ${{github.workspace}}/deploy/_config.next.yml_modify.sh $(pwd)/_config.next.yml
rm ./source/_posts/* -rf && cp ${{github.workspace}}/markdown/* ./source/_posts/
cp ${{github.workspace}}/deploy/CNAME ./source/
mkdir ./source/js && cp ${{github.workspace}}/js/* ./source/js/
hexo clean
hexo deploy --generate