Skip to content

通过 HTTPS 端口使用 SSH #77

通过 HTTPS 端口使用 SSH

通过 HTTPS 端口使用 SSH #77

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
# 只对特定分支生效
- hexo
env:
# 用于设置git提交的信息
GIT_USER: Sowevo
GIT_EMAIL: i@sowevo.com
jobs:
build:
strategy:
# 环境依赖
matrix:
os: [ubuntu-latest]
node_version: [18.x]
name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# 步骤
steps:
# 1.从git拉文件
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
# 2.安装node的环境
- name: Use Node.js lts
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
# 准备构建环境
- name: prepare build env
env:
HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}}
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: Install dependencies
run: |
npm i -g hexo-cli
npm i
# 编译并发布
- name: Deploy to github
run: |
hexo generate && hexo deploy